class DataMaps::Converter::ForEach
Apply Converter
for each entry
@since 0.3.3
Attributes
converter[R]
Public Instance Methods
after_initialize()
click to toggle source
The after initialize callback
# File lib/data_maps/converter/for_each.rb, line 10 def after_initialize @converter = DataMaps::Converter.create_from_map(option) end
execute(data)
click to toggle source
The execute converters for each value
@param [mixed] data @return [mixed] mutated data
# File lib/data_maps/converter/for_each.rb, line 18 def execute(data) case data when Array data.map do |value| converter.reduce(value) do |value, converter| converter.execute(value) end end else data end end