Class: Money::MeplatoBank
- Includes:
- Singleton
- Defined in:
- lib/money/meplato_bank.rb
Instance Method Summary collapse
- #add_rate(source, target, rate) ⇒ Object
- #get_rate(source, target) ⇒ Object
-
#initialize ⇒ MeplatoBank
constructor
A new instance of MeplatoBank.
Constructor Details
#initialize ⇒ MeplatoBank
Returns a new instance of MeplatoBank.
17 18 19 20 21 |
# File 'lib/money/meplato_bank.rb', line 17 def initialize @rates = {} @mutex = Mutex.new load_rates end |
Instance Method Details
#add_rate(source, target, rate) ⇒ Object
23 24 25 26 27 |
# File 'lib/money/meplato_bank.rb', line 23 def add_rate(source, target, rate) @mutex.synchronize do add_rate_synchronized(source, target, rate) end end |
#get_rate(source, target) ⇒ Object
29 30 31 32 33 |
# File 'lib/money/meplato_bank.rb', line 29 def get_rate(source, target) @mutex.synchronize do @rates["#{source}_#{target}".upcase] end end |