Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. class Jbreaker::DSL
  2. TYPE_FILEDS_CLASSES = {
  3. int: TypedField::Integer,
  4. string: TypedField::String,
  5. boolean: TypedField::Boolean,
  6. object: TypedField::Object,
  7. unknown: TypedField::Base
  8. }.freeze
  9.  
  10. def array_of(type_field)
  11. array_field = new TypedField::Array
  12. array_field.type_field = type_field
  13. array_field
  14. end
  15.  
  16. def optional(type_field)
  17. type_field.optional = true
  18. type_field
  19. end
  20.  
  21. def nullable(type_field)
  22. type_field.nullable = true
  23. type_field
  24. end
  25.  
  26. def method_missing(type)
  27. type_field = TYPE_FILEDS_CLASSES[:type]
  28. type_field.new
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement