Class: DataMaps::Converter::Postfix
- Inherits:
-
Base
- Object
- Executable
- Base
- DataMaps::Converter::Postfix
- Defined in:
- lib/data_maps/converter/affixes.rb
Overview
Adds a postfix to the given data
Instance Attribute Summary
Attributes inherited from Executable
Instance Method Summary collapse
-
#execute(data) ⇒ Object
The execute method to adds a postfix to the given data.
Methods inherited from Executable
#initialize, valid_collection?
Constructor Details
This class inherits a constructor from DataMaps::Executable
Instance Method Details
#execute(data) ⇒ Object
The execute method to adds a postfix to the given data
26 27 28 29 30 31 32 |
# File 'lib/data_maps/converter/affixes.rb', line 26 def execute(data) case data when Array then data.map{ |v| "#{v}#{option}" } when Hash then Hash[data.map{ |k,v| [k,"#{v}#{option}"] }] else "#{data}#{option}" end end |