Class: FlatMap::Mapping::Reader::Formatted
- Extended by:
- ActiveSupport::Autoload
- Includes:
- Formats
- Defined in:
- lib/flat_map/mapping/reader/formatted.rb
Overview
Formatted reader reads the value the same as Basic reader does, but additionally performs value postprocessing. All processing methods are defined within Formats module. The method is chosen based on the :format option when the mapping is defined.
Defined Under Namespace
Modules: Formats
Instance Attribute Summary
Attributes inherited from Basic
Instance Method Summary collapse
-
#initialize(mapping, format) ⇒ Formatted
constructor
Initialize the reader with a
mapping
and aformat
. -
#read(*args) ⇒ Object
Read the value just like the Basic reader does, but additionally send the returned value to its format method.
Methods included from Formats
Constructor Details
#initialize(mapping, format) ⇒ Formatted
Initialize the reader with a mapping
and a format
.
17 18 19 |
# File 'lib/flat_map/mapping/reader/formatted.rb', line 17 def initialize(mapping, format) @mapping, @format = mapping, format end |
Instance Method Details
#read(*args) ⇒ Object
Read the value just like the Basic reader does, but additionally send the returned value to its format method.
Additional arguments will be passed to formatting function of the mapping’s format.
28 29 30 |
# File 'lib/flat_map/mapping/reader/formatted.rb', line 28 def read(*args) format_value(super, *args) end |