Class: RESTinPeace::DefinitionProxy::AttributesDefinitions
- Inherits:
-
Object
- Object
- RESTinPeace::DefinitionProxy::AttributesDefinitions
- Defined in:
- lib/rest_in_peace/definition_proxy/attributes_definitions.rb
Instance Method Summary collapse
-
#initialize(target) ⇒ AttributesDefinitions
constructor
A new instance of AttributesDefinitions.
- #read(*attributes) ⇒ Object
- #write(*attributes) ⇒ Object
Constructor Details
#initialize(target) ⇒ AttributesDefinitions
Returns a new instance of AttributesDefinitions.
4 5 6 |
# File 'lib/rest_in_peace/definition_proxy/attributes_definitions.rb', line 4 def initialize(target) @target = target end |
Instance Method Details
#read(*attributes) ⇒ Object
8 9 10 11 |
# File 'lib/rest_in_peace/definition_proxy/attributes_definitions.rb', line 8 def read(*attributes) @target.send(:attr_reader, *attributes) @target.rip_attributes[:read].concat(attributes) end |
#write(*attributes) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rest_in_peace/definition_proxy/attributes_definitions.rb', line 13 def write(*attributes) read(*attributes) @target.send :attr_writer, *attributes @target.send :define_attribute_methods, attributes @target.rip_attributes[:write].concat(attributes) attributes.each do |attribute| define_dirty_tracking attribute end end |