Class: Gera::Rate

Inherits:
RateFromMultiplicator show all
Defined in:
lib/gera/rate.rb

Constant Summary

Constants inherited from RateFromMultiplicator

Gera::RateFromMultiplicator::FORMAT_ROUND

Instance Attribute Summary

Attributes inherited from RateFromMultiplicator

#value

Instance Method Summary collapse

Methods inherited from RateFromMultiplicator

#==, #exchange, #format, #in_amount, #initialize, #out_amount, #reverse_exchange, #to_rate, #to_s

Methods included from Mathematic

#calculate_base_rate, #calculate_comission, #calculate_finite_rate, #calculate_profits, #calculate_total_using_regular_comission, #calculate_total_using_reverse_comission, #diff_percents, #money_exchange, #money_reverse_exchange

Constructor Details

This class inherits a constructor from Gera::RateFromMultiplicator

Instance Method Details

#reverseObject



18
19
20
# File 'lib/gera/rate.rb', line 18

def reverse
  self.class.new(in_amount: out_amount, out_amount: in_amount).freeze
end

#to_dObject



10
11
12
# File 'lib/gera/rate.rb', line 10

def to_d
  out_amount.to_d / in_amount.to_d
end

#to_fObject



14
15
16
# File 'lib/gera/rate.rb', line 14

def to_f
  to_d.to_f
end