Sha256: 516c3f84c4bb4a6017802c3ea38e64a3968dea1ce176f52cb244f1787aa6b1ec

Contents?: true

Size: 754 Bytes

Versions: 19

Compression:

Stored size: 754 Bytes

Contents

module RedmineCrm
  class Currency
    module Loader
      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_iso.json")
        # currencies.merge! parse_currency_file("currency_non_iso.json")
        # currencies.merge! parse_currency_file("currency_backwards_compatible.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
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
test_redmine_vz-0.0.24 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.23 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.22 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.21 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.20 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.19 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.18 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.17 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.16 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.14 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.13 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.12 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.11 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.10 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.8 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.7 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.6 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.5 lib/redmine_crm/currency/loader.rb
redmine_crm-0.0.4 lib/redmine_crm/currency/loader.rb