module Mongomatic::TypedFields::ClassMethods

Public Instance Methods

typed_field(name, opts) click to toggle source
# 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() click to toggle source
# File lib/mongomatic/typed_fields.rb, line 32
def typed_fields
  @typed_fields || {}
end