class FlatMap::Mapping::Writer::Method
Method
writer calls a method defined by mapper and sends mapping and value to it as arguments.
Note that this doesn’t set anything on the target itself.
Public Class Methods
new(mapping, method)
click to toggle source
Initialize the writer with a mapping
and method
name that should be called on the mapping’s mapper.
@param [FlatMap::Mapping] mapping @param [Symbol] method
# File lib/flat_map/mapping/writer/method.rb, line 15 def initialize(mapping, method) @mapping, @method = mapping, method end
Public Instance Methods
write(value)
click to toggle source
Write a value
by sending it, along with the mapping itself.
@param [Object] value @return [Object] result of writing
# File lib/flat_map/mapping/writer/method.rb, line 23 def write(value) mapper.send(@method, mapping, value) end