class FlatMap::Mapping::Writer::Basic

Basic writer simply calls the target’s attribute assignment method passing to it the value being written.

Attributes

mapping[R]

Public Class Methods

new(mapping) click to toggle source

Initialize writer by passing mapping to it.

# File lib/flat_map/mapping/writer/basic.rb, line 11
def initialize(mapping)
  @mapping = mapping
end

Public Instance Methods

write(value) click to toggle source

Call the assignment method of the target, passing the value to it.

@param [Object] value @return [Object] result of assignment

# File lib/flat_map/mapping/writer/basic.rb, line 20
def write(value)
  target.send("#{target_attribute}=", value)
end