Module: Typical::DSL
- Extended by:
- Define
- Defined in:
- lib/typical/dsl.rb
Defined Under Namespace
Modules: Define
Constant Summary collapse
- BUILTIN_SCALAR_TYPES =
[ Integer, Float, Object, Range, Regexp, String, Symbol, Time, ].freeze
Instance Method Summary collapse
- #Array!(*types) ⇒ Object
- #Array?(*types) ⇒ Boolean
- #Hash!(types = {}) ⇒ Object
- #Hash?(types = {}) ⇒ Boolean
- #null ⇒ Object
- #Reference!(reference) ⇒ Object
- #Reference?(reference) ⇒ Boolean
- #Set!(*types) ⇒ Object
-
#Set?(*types) ⇒ Boolean
TODO: It actually appears that mongo/mongoid does not return ‘null` for set fields.
Instance Method Details
#Array!(*types) ⇒ Object
50 51 52 |
# File 'lib/typical/dsl.rb', line 50 def Array!(*types) Type::Array.new(types) end |
#Array?(*types) ⇒ Boolean
54 55 56 |
# File 'lib/typical/dsl.rb', line 54 def Array?(*types) Array!(*types) | null end |
#Hash!(types = {}) ⇒ Object
33 34 35 |
# File 'lib/typical/dsl.rb', line 33 def Hash!(types = {}) Type::Hash.new(types) end |
#Hash?(types = {}) ⇒ Boolean
37 38 39 |
# File 'lib/typical/dsl.rb', line 37 def Hash?(types = {}) Hash!(types) | null end |
#Reference!(reference) ⇒ Object
58 59 60 |
# File 'lib/typical/dsl.rb', line 58 def Reference!(reference) Type::Reference.new(reference) end |
#Reference?(reference) ⇒ Boolean
62 63 64 |
# File 'lib/typical/dsl.rb', line 62 def Reference?(reference) Reference!(reference) | null end |
#Set!(*types) ⇒ Object
41 42 43 |
# File 'lib/typical/dsl.rb', line 41 def Set!(*types) Type::Set.new(*types) end |
#Set?(*types) ⇒ Boolean
TODO: It actually appears that mongo/mongoid does not return ‘null` for set fields.
46 47 48 |
# File 'lib/typical/dsl.rb', line 46 def Set?(*types) Set!(*types) | null end |