Class: Goods::Currency

Inherits:
Object
  • Object
show all
Includes:
Containable
Defined in:
lib/goods/currency.rb

Instance Method Summary collapse

Methods included from Containable

#id, included, #invalid_fields, #valid?

Constructor Details

#initialize(info_hash) ⇒ Currency

Returns a new instance of Currency.



5
6
7
# File 'lib/goods/currency.rb', line 5

def initialize(info_hash)
  self._info_hash = info_hash
end

Instance Method Details

#in(other_currency) ⇒ Object



17
18
19
# File 'lib/goods/currency.rb', line 17

def in(other_currency)
  self.rate/other_currency.rate
end

#plusObject



13
14
15
# File 'lib/goods/currency.rb', line 13

def plus
  @plus ||= _info_hash[:plus].to_f
end

#rateObject



9
10
11
# File 'lib/goods/currency.rb', line 9

def rate
  @rate ||= _info_hash[:rate].to_f
end