Sha256: 779cfa0e0d89c4cbaa2687ea5e130b97666fdf517f4e77bcdbe498eeac6caa1a

Contents?: true

Size: 587 Bytes

Versions: 4

Compression:

Stored size: 587 Bytes

Contents

module Redmineup
  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
        parse_currency_file('currency_iso.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

4 entries across 4 versions & 1 rubygems

Version Path
redmineup-1.0.5 lib/redmineup/currency/loader.rb
redmineup-1.0.4 lib/redmineup/currency/loader.rb
redmineup-1.0.3 lib/redmineup/currency/loader.rb
redmineup-1.0.2 lib/redmineup/currency/loader.rb