Class: Goods::Currency
Instance Method Summary
collapse
#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
|
#plus ⇒ Object
13
14
15
|
# File 'lib/goods/currency.rb', line 13
def plus
@plus ||= _info_hash[:plus].to_f
end
|
#rate ⇒ Object
9
10
11
|
# File 'lib/goods/currency.rb', line 9
def rate
@rate ||= _info_hash[:rate].to_f
end
|