Class: RESTinPeace::DefinitionProxy::AttributesDefinitions

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_in_peace/definition_proxy/attributes_definitions.rb

Instance Method Summary collapse

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
# File 'lib/rest_in_peace/definition_proxy/attributes_definitions.rb', line 13

def write(*attributes)
  read(*attributes)
  @target.send(:attr_writer, *attributes)
  @target.rip_attributes[:write].concat(attributes)
end