Class: Money::FixedBank
- Includes:
- Singleton
- Defined in:
- lib/money/fixed_bank.rb
Instance Method Summary collapse
- #add_rate(source, target, rate) ⇒ Object
- #get_rate(source, target) ⇒ Object
-
#initialize ⇒ FixedBank
constructor
A new instance of FixedBank.
Constructor Details
#initialize ⇒ FixedBank
Returns a new instance of FixedBank.
10 11 12 13 |
# File 'lib/money/fixed_bank.rb', line 10 def initialize @rates = {} @mutex = Mutex.new end |
Instance Method Details
#add_rate(source, target, rate) ⇒ Object
15 16 17 18 19 |
# File 'lib/money/fixed_bank.rb', line 15 def add_rate(source, target, rate) @mutex.synchronize do @rates["#{source}_#{target}".upcase] = rate end end |
#get_rate(source, target) ⇒ Object
21 22 23 24 25 |
# File 'lib/money/fixed_bank.rb', line 21 def get_rate(source, target) @mutex.synchronize do @rates["#{source}_#{target}".upcase] end end |