Module: Gera::CurrencyPairSupport

Extended by:
ActiveSupport::Concern
Included in:
CrossRateMode, CurrencyRate, CurrencyRateMode, ExternalRate
Defined in:
app/models/concerns/gera/currency_pair_support.rb

Instance Method Summary collapse

Instance Method Details

#currency_fromObject



34
35
36
# File 'app/models/concerns/gera/currency_pair_support.rb', line 34

def currency_from
  @currency_from ||= cur_from.is_a?(Money::Currency) ? cur_from : Money::Currency.find!(cur_from)
end

#currency_pairObject



30
31
32
# File 'app/models/concerns/gera/currency_pair_support.rb', line 30

def currency_pair
  @currency_pair ||= Gera::CurrencyPair.new currency_from, currency_to
end

#currency_pair=(value) ⇒ Object



21
22
23
24
25
26
27
28
# File 'app/models/concerns/gera/currency_pair_support.rb', line 21

def currency_pair=(value)
  self.cur_from = value.cur_from
  self.cur_to = value.cur_to
  @currency_pair = nil
  @currency_from = nil
  @currency_to = nil
  value
end

#currency_toObject



38
39
40
# File 'app/models/concerns/gera/currency_pair_support.rb', line 38

def currency_to
  @currency_to ||= cur_to.is_a?(Money::Currency) ? cur_to : Money::Currency.find!(cur_to)
end