Module: Humanoid::Fields::ClassMethods
- Defined in:
- lib/humanoid/fields.rb
Overview
:nodoc
Instance Method Summary collapse
-
#field(name, options = {}) ⇒ Object
Defines all the fields that are accessable on the Document For each field that is defined, a getter and setter will be added as an instance method to the Document.
Instance Method Details
#field(name, options = {}) ⇒ Object
Defines all the fields that are accessable on the Document For each field that is defined, a getter and setter will be added as an instance method to the Document.
Options:
name: The name of the field, as a Symbol
. options: A Hash
of options to supply to the Field
.
Example:
field :score, :default => 0
31 32 33 34 35 |
# File 'lib/humanoid/fields.rb', line 31 def field(name, = {}) access = name.to_s set_field(access, ) set_default(access, ) end |