Class: TLD::Currency

Inherits:
Object
  • Object
show all
Defined in:
lib/tld/currency.rb

Constant Summary collapse

CURRENCY_MAP =
{
  :eu  => %w{EUR},
  :gov => %w{USD},
  :mil => %w{USD}
}

Class Method Summary collapse

Class Method Details

.find(klass) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/tld/currency.rb', line 13

def find(klass)
  tld = klass.tld
  mapped_currency = CURRENCY_MAP[tld.to_sym]
  if mapped_currency.nil?
    return tld.match(/^\w\w$/) ? IsoCountryCodes.find(TLD::MAP[tld.to_sym] || tld).currencies : []
  else
    return mapped_currency
  end
end