module RedmineCrm::Currency::Loader

Constants

DATA_PATH

Public Instance Methods

load_currencies() click to toggle source

Loads and returns the currencies stored in JSON files in the config directory.

@return [Hash]

# File lib/redmine_crm/currency/loader.rb, line 10
def load_currencies
  parse_currency_file('currency_iso.json')
end

Private Instance Methods

parse_currency_file(filename) click to toggle source
# File lib/redmine_crm/currency/loader.rb, line 16
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