Class: Trader::InverseConverter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_inverse) ⇒ InverseConverter

Returns a new instance of InverseConverter.



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

def initialize(_inverse)
  @inverse = _inverse
end

Instance Attribute Details

#inverseObject (readonly)

Returns the value of attribute inverse.



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

def inverse
  @inverse
end

Instance Method Details

#rateObject



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

def rate
  1.0 / inverse.rate
end