Class: Xurrency
- Inherits:
-
Object
- Object
- Xurrency
- Defined in:
- lib/xurrency.rb
Defined Under Namespace
Modules: Request Classes: Client
Constant Summary collapse
- VERSION =
"002"
Instance Method Summary collapse
-
#initialize(init = nil) ⇒ Xurrency
constructor
A new instance of Xurrency.
-
#value(amount, base, target) ⇒ Object
Calculates the value without quering getValue.
Constructor Details
#initialize(init = nil) ⇒ Xurrency
Returns a new instance of Xurrency.
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/xurrency.rb', line 78 def initialize(init = nil) @cache = {} memoize :currency_name memoize :zone memoize :url memoize :currencies memoize :values memoize :values_inverse if init init = Request.currencies if init == :all init.each {|c| values(c) } end end |
Instance Method Details
#value(amount, base, target) ⇒ Object
Calculates the value without quering getValue.
93 94 95 |
# File 'lib/xurrency.rb', line 93 def value(amount, base, target) values(base)[target] * amount end |