Class: DataMaps::Then::Convert

Inherits:
Base show all
Defined in:
lib/data_maps/then/convert.rb

Overview

A then to convert values

Since:

  • 0.0.1

Instance Attribute Summary collapse

Attributes inherited from Executable

#@option, #option

Instance Method Summary collapse

Methods inherited from Executable

#initialize, valid_collection?

Constructor Details

This class inherits a constructor from DataMaps::Executable

Instance Attribute Details

#converterObject (readonly)

Since:

  • 0.0.1



7
8
9
# File 'lib/data_maps/then/convert.rb', line 7

def converter
  @converter
end

Instance Method Details

#after_initializeObject

Since:

  • 0.0.1



9
10
11
# File 'lib/data_maps/then/convert.rb', line 9

def after_initialize
  @converter = DataMaps::Converter.create_from_map(option)
end

#execute(data) ⇒ Object

The execute method which returns the converted data

Parameters:

  • data (mixed)

Since:

  • 0.0.1



16
17
18
19
20
# File 'lib/data_maps/then/convert.rb', line 16

def execute(data)
  converter.reduce(data) do |data, c|
    c.execute(data)
  end
end