Class: DataMaps::Mapper
- Inherits:
-
Object
- Object
- DataMaps::Mapper
- Defined in:
- lib/data_maps/mapper.rb
Overview
The base mapper class which handles all mapping logic
Instance Attribute Summary collapse
-
#mapping ⇒ Object
Attribute Accessors.
Instance Method Summary collapse
-
#convert(data) ⇒ Object
Execute.
-
#initialize(mapping) ⇒ Mapper
constructor
Initializer for the Mapper class.
Constructor Details
#initialize(mapping) ⇒ Mapper
Initializer for the Mapper class
14 15 16 17 18 |
# File 'lib/data_maps/mapper.rb', line 14 def initialize(mapping) raise ArgumentError.new('The mapping should be a DataMaps::Mapping::Base') unless mapping.is_a? DataMaps::Mapping @mapping = mapping end |
Instance Attribute Details
#mapping ⇒ Object
Attribute Accessors
6 7 8 |
# File 'lib/data_maps/mapper.rb', line 6 def mapping @mapping end |
Instance Method Details
#convert(data) ⇒ Object
Execute
21 22 23 |
# File 'lib/data_maps/mapper.rb', line 21 def convert(data) mapping.execute(data.stringify_keys) end |