class FlatMap::Mapping::Reader::Method

Method mapper calls a method, defined by the mapper, sending the mapping object to it as an argument.

Public Class Methods

new(mapping, method) click to toggle source

Initialize the reader with a mapping and a method.

@param [FlatMap::Mapping] mapping @param [Symbol] method name

# File lib/flat_map/mapping/reader/method.rb, line 12
def initialize(mapping, method)
  @mapping, @method = mapping, method
end

Public Instance Methods

read() click to toggle source

Send the @method to the mapping’s mapper, passing the mapping itself to it.

@return [Object] value returned by reader

# File lib/flat_map/mapping/reader/method.rb, line 20
def read
  mapper.send(@method, mapping)
end