Module: StrongJSON::Types
- Included in:
- StrongJSON
- Defined in:
- lib/strong_json/types.rb
Instance Method Summary collapse
- #any ⇒ Object
- #array(type = any) ⇒ Object
- #boolean ⇒ Object
- #boolean? ⇒ Boolean
- #number ⇒ Object
- #number? ⇒ Boolean
- #numeric ⇒ Object
- #numeric? ⇒ Boolean
- #object(fields = {}) ⇒ Object
- #optional(type = any) ⇒ Object
- #prohibited ⇒ Object
- #string ⇒ Object
- #string? ⇒ Boolean
Instance Method Details
#any ⇒ Object
31 32 33 |
# File 'lib/strong_json/types.rb', line 31 def any StrongJSON::Type::Base.new(:any) end |
#array(type = any) ⇒ Object
7 8 9 |
# File 'lib/strong_json/types.rb', line 7 def array(type = any) Type::Array.new(type) end |
#boolean ⇒ Object
27 28 29 |
# File 'lib/strong_json/types.rb', line 27 def boolean StrongJSON::Type::Base.new(:boolean) end |
#boolean? ⇒ Boolean
51 52 53 |
# File 'lib/strong_json/types.rb', line 51 def boolean? optional(boolean) end |
#number ⇒ Object
23 24 25 |
# File 'lib/strong_json/types.rb', line 23 def number StrongJSON::Type::Base.new(:number) end |
#number? ⇒ Boolean
47 48 49 |
# File 'lib/strong_json/types.rb', line 47 def number? optional(number) end |
#numeric ⇒ Object
19 20 21 |
# File 'lib/strong_json/types.rb', line 19 def numeric StrongJSON::Type::Base.new(:numeric) end |
#numeric? ⇒ Boolean
43 44 45 |
# File 'lib/strong_json/types.rb', line 43 def numeric? optional(numeric) end |
#object(fields = {}) ⇒ Object
3 4 5 |
# File 'lib/strong_json/types.rb', line 3 def object(fields = {}) Type::Object.new(fields) end |
#optional(type = any) ⇒ Object
11 12 13 |
# File 'lib/strong_json/types.rb', line 11 def optional(type = any) Type::Optional.new(type) end |
#prohibited ⇒ Object
35 36 37 |
# File 'lib/strong_json/types.rb', line 35 def prohibited StrongJSON::Type::Base.new(:prohibited) end |
#string ⇒ Object
15 16 17 |
# File 'lib/strong_json/types.rb', line 15 def string StrongJSON::Type::Base.new(:string) end |
#string? ⇒ Boolean
39 40 41 |
# File 'lib/strong_json/types.rb', line 39 def string? optional(string) end |