Module: Mongoid::Fields
- Extended by:
- ActiveSupport::Concern
- Included in:
- Components
- Defined in:
- lib/mongoid/fields.rb,
lib/mongoid/fields/mappings.rb,
lib/mongoid/fields/serializable.rb,
lib/mongoid/fields/serializable/set.rb,
lib/mongoid/fields/serializable/date.rb,
lib/mongoid/fields/serializable/hash.rb,
lib/mongoid/fields/serializable/time.rb,
lib/mongoid/fields/serializable/array.rb,
lib/mongoid/fields/serializable/float.rb,
lib/mongoid/fields/serializable/range.rb,
lib/mongoid/fields/serializable/bignum.rb,
lib/mongoid/fields/serializable/binary.rb,
lib/mongoid/fields/serializable/fixnum.rb,
lib/mongoid/fields/serializable/object.rb,
lib/mongoid/fields/serializable/string.rb,
lib/mongoid/fields/serializable/symbol.rb,
lib/mongoid/fields/serializable/boolean.rb,
lib/mongoid/fields/serializable/integer.rb,
lib/mongoid/fields/serializable/date_time.rb,
lib/mongoid/fields/serializable/localized.rb,
lib/mongoid/fields/serializable/nil_class.rb,
lib/mongoid/fields/serializable/object_id.rb,
lib/mongoid/fields/serializable/big_decimal.rb,
lib/mongoid/fields/serializable/timekeeping.rb,
lib/mongoid/fields/serializable/time_with_zone.rb,
lib/mongoid/fields/serializable/foreign_keys/array.rb,
lib/mongoid/fields/serializable/foreign_keys/object.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods, Mappings, Serializable
Class Method Summary collapse
-
.option(option_name, &block) ⇒ Object
Stores the provided block to be run when the option name specified is defined on a field.
-
.options ⇒ Hash
Return a map of custom option names to their handlers.
Instance Method Summary collapse
-
#defaults ⇒ Array<String>
Get the default fields.
-
#fields ⇒ Hash
Get the document’s fields.
Class Method Details
.option(option_name, &block) ⇒ Object
Stores the provided block to be run when the option name specified is defined on a field.
No assumptions are made about what sort of work the handler might perform, so it will always be called if the ‘option_name` key is provided in the field definition – even if it is false or nil.
86 87 88 |
# File 'lib/mongoid/fields.rb', line 86 def option(option_name, &block) [option_name] = block end |
.options ⇒ Hash
Return a map of custom option names to their handlers.
99 100 101 |
# File 'lib/mongoid/fields.rb', line 99 def @options ||= {} end |
Instance Method Details
#defaults ⇒ Array<String>
Refactored from using delegate for class load performance.
Get the default fields.
51 52 53 |
# File 'lib/mongoid/fields.rb', line 51 def defaults self.class.defaults end |
#fields ⇒ Hash
Refactored from using delegate for class load performance.
Get the document’s fields.
63 64 65 |
# File 'lib/mongoid/fields.rb', line 63 def fields self.class.fields end |