Class: MemoryModel::Base::Fieldable::Field
- Defined in:
- lib/memory_model/base/fieldable/field.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #==(other_object) ⇒ Object
- #comparable? ⇒ Boolean
- #default ⇒ Object
-
#initialize(name, options = { }) ⇒ Field
constructor
A new instance of Field.
- #readonly? ⇒ Boolean
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(name, options = { }) ⇒ Field
Returns a new instance of Field.
6 7 8 9 |
# File 'lib/memory_model/base/fieldable/field.rb', line 6 def initialize(name, ={ }) @name = name.to_sym = .reverse_merge!({ readonly: false, comparable: true }) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/memory_model/base/fieldable/field.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/memory_model/base/fieldable/field.rb', line 3 def end |
Instance Method Details
#==(other_object) ⇒ Object
11 12 13 |
# File 'lib/memory_model/base/fieldable/field.rb', line 11 def ==(other_object) self.to_sym == other_object.to_sym end |
#comparable? ⇒ Boolean
15 16 17 |
# File 'lib/memory_model/base/fieldable/field.rb', line 15 def comparable? !![:comparable] end |
#default ⇒ Object
19 20 21 |
# File 'lib/memory_model/base/fieldable/field.rb', line 19 def default [:default] end |
#readonly? ⇒ Boolean
23 24 25 |
# File 'lib/memory_model/base/fieldable/field.rb', line 23 def readonly? !![:readonly] end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/memory_model/base/fieldable/field.rb', line 31 def to_s @name.to_s end |
#to_sym ⇒ Object
27 28 29 |
# File 'lib/memory_model/base/fieldable/field.rb', line 27 def to_sym @name.to_sym end |