Class: FlatMap::Mapping::Reader::Basic
- Inherits:
-
Object
- Object
- FlatMap::Mapping::Reader::Basic
- Defined in:
- lib/flat_map/mapping/reader/basic.rb
Overview
Basic reader simply sends a mapped attribute to the target and returns the result value.
Instance Attribute Summary collapse
-
#mapping ⇒ Object
readonly
Returns the value of attribute mapping.
Instance Method Summary collapse
-
#initialize(mapping) ⇒ Basic
constructor
Initialize the reader with a mapping.
-
#read ⇒ Object
Send the attribute method to the target and return its value.
Constructor Details
#initialize(mapping) ⇒ Basic
Initialize the reader with a mapping.
13 14 15 |
# File 'lib/flat_map/mapping/reader/basic.rb', line 13 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/reader/basic.rb', line 6 def mapping @mapping end |
Instance Method Details
#read ⇒ Object
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)
23 24 25 |
# File 'lib/flat_map/mapping/reader/basic.rb', line 23 def read(*) target.send(target_attribute) end |