Sha256: bcf8f210c2bdd55513aaeaff55e292cf35d302344234c53d92c8c6ad54a056f7
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
require 'economy/extensions/active_record/base' require 'economy/rates/base' require 'economy/rates/yahoo' require 'economy/builder' require 'economy/cache' require 'economy/configuration' require 'economy/currencies' require 'economy/currency' require 'economy/money' require 'economy/railtie' require 'economy/version' module Economy class << self def cache @cache ||= Cache.new end def currencies @currencies ||= Currencies.new end def configuration @configuration ||= Configuration.new end def configure yield configuration end def rate(*args) cache.send :fetch, *args end 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
economy-4.0.2.2 | lib/economy.rb |
economy-4.0.2.1 | lib/economy.rb |
economy-4.0.2.0 | lib/economy.rb |