Module: Cashish::Currency
- Extended by:
- ActiveSupport::Memoizable
- Defined in:
- lib/cashish/currency.rb
Constant Summary collapse
- CURRENCIES =
en.wikipedia.org/wiki/ISO_4217
Code | Num | E | Currency | Locations using this currency HKD | 344 | 2 | Hong Kong dollar | Hong Kong Special Administrative Region
YAML.load(File.read(File.dirname(__FILE__)+"/currencies.yml"))
Class Method Summary collapse
- .codes ⇒ Object
- .find_by_code(code) ⇒ Object (also: [])
Class Method Details
.codes ⇒ Object
31 32 33 |
# File 'lib/cashish/currency.rb', line 31 def codes CURRENCIES.keys end |
.find_by_code(code) ⇒ Object Also known as: []
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cashish/currency.rb', line 16 def find_by_code(code) if currency = CURRENCIES[code] if currency["e"].is_a?(Fixnum) currency else raise "I don't know how to handle this currency #{code} with e=#{currency["e"]}" end else raise(MissingCurrencyException, "no currency #{code}") end end |