Class: Money::MeplatoBank

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/money/meplato_bank.rb

Instance Method Summary collapse

Constructor Details

#initializeMeplatoBank

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