Class: Trader::CompoundConverter

Inherits:
Converter show all
Defined in:
lib/trade-o-matic/converters/compound_converter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_converters) ⇒ CompoundConverter

Returns a new instance of CompoundConverter.



5
6
7
# File 'lib/trade-o-matic/converters/compound_converter.rb', line 5

def initialize(_converters)
  @converters = _converters
end

Instance Attribute Details

#convertersObject

Returns the value of attribute converters.



3
4
5
# File 'lib/trade-o-matic/converters/compound_converter.rb', line 3

def converters
  @converters
end

Instance Method Details

#rateObject



9
10
11
# File 'lib/trade-o-matic/converters/compound_converter.rb', line 9

def rate
  converters.inject(1.0) { |r, c| c.rate * r }
end