Class: FlatMap::Mapping::Writer::Basic
- Inherits:
-
Object
- Object
- FlatMap::Mapping::Writer::Basic
- Defined in:
- lib/flat_map/mapping/writer/basic.rb
Overview
Basic writer simply calls the target’s attribute assignment method passing to it the value being written.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#mapping ⇒ Object
readonly
Returns the value of attribute mapping.
Instance Method Summary collapse
-
#initialize(mapping) ⇒ Basic
constructor
Initialize writer by passing
mapping
to it. -
#write(value) ⇒ Object
Call the assignment method of the target, passing the
value
to it.
Constructor Details
#initialize(mapping) ⇒ Basic
Initialize writer by passing mapping
to it.
11 12 13 |
# File 'lib/flat_map/mapping/writer/basic.rb', line 11 def initialize(mapping) @mapping = mapping end |
Instance Attribute Details
#mapping ⇒ Object (readonly)
Returns the value of attribute mapping.
6 7 8 |
# File 'lib/flat_map/mapping/writer/basic.rb', line 6 def mapping @mapping end |
Instance Method Details
#write(value) ⇒ Object
Call the assignment method of the target, passing the value
to it.
20 21 22 |
# File 'lib/flat_map/mapping/writer/basic.rb', line 20 def write(value) target.send("#{target_attribute}=", value) end |