Module: WCC::Data::Mapper::Attributes::InstanceMethods
- Defined in:
- lib/wcc/data/mapper/attributes.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/wcc/data/mapper/attributes.rb', line 11 def attributes @attributes end |
Instance Method Details
#[](attribute) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/wcc/data/mapper/attributes.rb', line 17 def [](attribute) self.class.attributes.fetch(attribute.to_s) { raise KeyError, "The attribute #{attribute} is not defined" } @attributes[attribute.to_s] end |
#[]=(attribute, value) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/wcc/data/mapper/attributes.rb', line 24 def []=(attribute, value) self.class.attributes.fetch(attribute.to_s) { raise KeyError, "The attribute #{attribute} is not defined" } @attributes[attribute.to_s] = value end |
#initialize(attributes = {}) ⇒ Object
13 14 15 |
# File 'lib/wcc/data/mapper/attributes.rb', line 13 def initialize(attributes={}) @attributes = attributes end |