Class: ISOCodes::Currency

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, fields, find, find_all, #initialize

Constructor Details

This class inherits a constructor from ISOCodes::Base

Class Method Details

.dataObject



8
9
10
# File 'lib/iso_codes/currency.rb', line 8

def self.data
  Data::Currencies
end

.find_by_country(country) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/iso_codes/currency.rb', line 18

def self.find_by_country(country)
  country = country.a2 if country.is_a?(Country)
  
  data.each do |item|
    return self.new(item) if item[:country_a2].include?(country)
  end
end

Instance Method Details

#countriesObject



12
13
14
15
16
# File 'lib/iso_codes/currency.rb', line 12

def countries
  country_a2.collect do |code|
    Country.find_by_a2(code)
  end
end