Sha256: c98bd06e6784ca1b23e21a32983f3547a19ef0acc446e30a9cd06e3a49de657e

Contents?: true

Size: 569 Bytes

Versions: 11

Compression:

Stored size: 569 Bytes

Contents

module CurrencyLoader
  extend self

  DATA_PATH = File.expand_path("../../../config", __FILE__)

  # Loads and returns the currencies stored in JSON files in the config directory.
  #
  # @return [Hash]
  def load_currencies
    currencies = parse_currency_file("currency.json")
    currencies.merge! parse_currency_file("currency_bc.json")
  end

  private

  def parse_currency_file(filename)
    json = File.read("#{DATA_PATH}/#{filename}")
    json.force_encoding(::Encoding::UTF_8) if defined?(::Encoding)
    JSON.parse(json, :symbolize_names => true)
  end
end

Version data entries

11 entries across 6 versions & 2 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/decimal-money-5.1.1.patched/lib/money/currency_loader.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/decimal-money-5.1.1.patched/lib/money/currency_loader.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/decimal-money-5.1.1.patched/lib/money/currency_loader.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/decimal-money-5.1.1.patched/lib/money/currency_loader.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/decimal-money-5.1.1.patched/lib/money/currency_loader.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/decimal-money-5.1.1.patched/lib/money/currency_loader.rb
money-5.1.0.beta1 lib/money/currency_loader.rb
money-5.0.0 lib/money/currency_loader.rb
money-5.0.0.rc2 lib/money/currency_loader.rb
money-5.0.0.rc1 lib/money/currency_loader.rb
money-4.0.2 lib/money/currency_loader.rb