Sha256: 5b8903274c737ff6e521ba3ae2a4b373f44fcd532800308031abde245b3fd0ec
Contents?: true
Size: 932 Bytes
Versions: 2
Compression:
Stored size: 932 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 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
economy-4.0.1.0 | lib/economy.rb |
economy-4.0.0.0 | lib/economy.rb |