Module: Trader::ConverterConfigurator

Extended by:
ConverterConfigurator
Included in:
ConverterConfigurator
Defined in:
lib/trade-o-matic/support/converter_configurator.rb

Instance Method Summary collapse

Instance Method Details

#from_yaml(_yaml) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/trade-o-matic/support/converter_configurator.rb', line 5

def from_yaml(_yaml)
  _yaml.each do |conv|
    type = conv['type'] || detect_type(conv)
    converter = send "configure_yaml_#{type}", conv

    Currency.register_conversion conv['from'], conv['to'], converter, inverse: !!conv['inverse']
    Currency.register_conversion conv['to'], conv['from'], converter, inverse: !conv['inverse'] if conv['symetric']
  end
end