Module: Mongomatic::TypedFields::ClassMethods
- Defined in:
- lib/mongomatic/typed_fields.rb
Instance Method Summary collapse
Instance Method Details
#typed_field(name, opts) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mongomatic/typed_fields.rb', line 21 def typed_field(name, opts) unless Mongomatic::TypedFields::KNOWN_TYPES.include?(opts[:type]) raise Mongomatic::TypedFields::InvalidType, "#{opts[:type]}" end opts = {:cast => true}.merge(opts) @typed_fields ||= {} @typed_fields[name] = opts end |
#typed_fields ⇒ Object
32 33 34 |
# File 'lib/mongomatic/typed_fields.rb', line 32 def typed_fields @typed_fields || {} end |