Sha256: d67f7b3977fb9010478dc456e855753c415f38fcb924f3764cbdeca25f4a6e21
Contents?: true
Size: 671 Bytes
Versions: 16
Compression:
Stored size: 671 Bytes
Contents
require 'json' class Money class Currency module Loader extend self CURRENCY_DATA_PATH = File.expand_path("../../../../config", __FILE__) def load_currencies currencies = {} currencies.merge! parse_currency_file("currency_historic.json") currencies.merge! parse_currency_file("currency_non_iso.json") currencies.merge! parse_currency_file("currency_iso.json") end private def parse_currency_file(filename) json = File.read("#{CURRENCY_DATA_PATH}/#{filename}") json.force_encoding(::Encoding::UTF_8) if defined?(::Encoding) JSON.parse(json) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems