Class: Dynorm::Item
- Inherits:
-
Object
- Object
- Dynorm::Item
- Defined in:
- lib/dynorm/item.rb
Instance Method Summary collapse
-
#initialize(table_config, attrs) ⇒ Item
constructor
A new instance of Item.
- #update_attributes(items) ⇒ Object
Constructor Details
#initialize(table_config, attrs) ⇒ Item
Returns a new instance of Item.
5 6 7 8 9 10 11 12 |
# File 'lib/dynorm/item.rb', line 5 def initialize(table_config, attrs) @table_config = table_config @attrs = attrs @attrs.keys.each do |key| self.class.define_method(key) { @attrs[key] } end end |
Instance Method Details
#update_attributes(items) ⇒ Object
14 15 16 17 |
# File 'lib/dynorm/item.rb', line 14 def update_attributes(items) @attrs = @attrs.merge(items) update_attribute_params end |