module Economy
Constants
- VERSION
Public Class Methods
cache()
click to toggle source
# File lib/economy.rb, line 18 def cache @cache ||= Cache.new end
configuration()
click to toggle source
# File lib/economy.rb, line 26 def configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/economy.rb, line 30 def configure yield configuration end
currencies()
click to toggle source
# File lib/economy.rb, line 22 def currencies @currencies ||= Currencies.new end
rate(*args)
click to toggle source
# File lib/economy.rb, line 34 def rate(*args) cache.send :fetch, *args end
update_rates()
click to toggle source
# File lib/economy.rb, line 38 def update_rates class_name = configuration.rates.to_s.classify rates = Rates.const_get(class_name).new rates.fetch.each do |from, to, rate| puts "Updating exchange #{from} => #{to} with rate #{rate}" Exchange.create service: class_name, from: from, to: to, rate: rate end end