class FlatMap::Mapping::Reader::Basic

Basic reader simply sends a mapped attribute to the target and returns the result value.

Attributes

mapping[R]

Public Class Methods

new(mapping) click to toggle source

Initialize the reader with a mapping.

@param [FlatMap::Mapping] mapping

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

Public Instance Methods

read(*) click to toggle source

Send the attribute method to the target and return its value. As a base class for readers, it allows to pass additional arguments when reading value (for example, used by :enum format of {Formatted} reader)

@return [Object] value returned by reading

# File lib/flat_map/mapping/reader/basic.rb, line 23
def read(*)
  target.send(target_attribute)
end