Sha256: 2d54be7e0d2cd236e6e6707862078399521c296064a9e81f92ea14ef7347e8ab
Contents?: true
Size: 827 Bytes
Versions: 5
Compression:
Stored size: 827 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Shared module Currencies class << self def countries resource.keys.map(&:to_s) end def currency_codes resource.values.map { |data| data[:code] } end def for_country(country_name) resource[country_name.to_sym] end def for_code(currency_code) country_name, data = resource.detect { |_, data| data[:code] == currency_code } { :country => country_name.to_s, :currency => data[:currency], :symbol => data[:symbol] } if data end private def resource @resource ||= TwitterCldr.get_resource(:shared, :currencies) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems