Class: IsoCountryCodes::Code

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/iso_country_codes/code.rb,
lib/iso_country_codes/iso_4217.rb,
lib/iso_country_codes/iso_3166_1.rb

Direct Known Subclasses

ABW, AFG, AGO, AIA, ALA, ALB, AND, ANT, ARE, ARG, ARM, ASM, ATA, ATF, ATG, AUS, AUT, AZE, BDI, BEL, BEN, BFA, BGD, BGR, BHR, BHS, BIH, BLM, BLR, BLZ, BMU, BOL, BRA, BRB, BRN, BTN, BVT, BWA, CAF, CAN, CCK, CHE, CHL, CHN, CIV, CMR, COD, COG, COK, COL, COM, CPV, CRI, CUB, CXR, CYM, CYP, CZE, DEU, DJI, DMA, DNK, DOM, DZA, ECU, EGY, ERI, ESH, ESP, EST, ETH, FIN, FJI, FLK, FRA, FRO, FSM, GAB, GBR, GEO, GGY, GHA, GIB, GIN, GLP, GMB, GNB, GNQ, GRC, GRD, GRL, GTM, GUF, GUM, GUY, HKG, HMD, HND, HRV, HTI, HUN, IDN, IMN, IND, IOT, IRL, IRN, IRQ, ISL, ISR, ITA, JAM, JEY, JOR, JPN, KAZ, KEN, KGZ, KHM, KIR, KNA, KOR, KWT, LAO, LBN, LBR, LBY, LCA, LIE, LKA, LSO, LTU, LUX, LVA, MAC, MAF, MAR, MCO, MDA, MDG, MDV, MEX, MHL, MKD, MLI, MLT, MMR, MNE, MNG, MNP, MOZ, MRT, MSR, MTQ, MUS, MWI, MYS, MYT, NAM, NCL, NER, NFK, NGA, NIC, NIU, NLD, NOR, NPL, NRU, NZL, OMN, PAK, PAN, PCN, PER, PHL, PLW, PNG, POL, PRI, PRK, PRT, PRY, PSE, PYF, QAT, REU, ROU, RUS, RWA, SAU, SDN, SEN, SGP, SGS, SHN, SJM, SLB, SLE, SLV, SMR, SOM, SPM, SRB, STP, SUR, SVK, SVN, SWE, SWZ, SYC, SYR, TCA, TCD, TGO, THA, TJK, TKL, TKM, TLS, TON, TTO, TUN, TUR, TUV, TWN, TZA, UGA, UKR, UMI, URY, USA, UZB, VAT, VCT, VEN, VGB, VIR, VNM, VUT, WLF, WSM, YEM, ZAF, ZMB, ZWE

Defined Under Namespace

Classes: ABW, AFG, AGO, AIA, ALA, ALB, AND, ANT, ARE, ARG, ARM, ASM, ATA, ATF, ATG, AUS, AUT, AZE, BDI, BEL, BEN, BFA, BGD, BGR, BHR, BHS, BIH, BLM, BLR, BLZ, BMU, BOL, BRA, BRB, BRN, BTN, BVT, BWA, CAF, CAN, CCK, CHE, CHL, CHN, CIV, CMR, COD, COG, COK, COL, COM, CPV, CRI, CUB, CXR, CYM, CYP, CZE, DEU, DJI, DMA, DNK, DOM, DZA, ECU, EGY, ERI, ESH, ESP, EST, ETH, FIN, FJI, FLK, FRA, FRO, FSM, GAB, GBR, GEO, GGY, GHA, GIB, GIN, GLP, GMB, GNB, GNQ, GRC, GRD, GRL, GTM, GUF, GUM, GUY, HKG, HMD, HND, HRV, HTI, HUN, IDN, IMN, IND, IOT, IRL, IRN, IRQ, ISL, ISR, ITA, JAM, JEY, JOR, JPN, KAZ, KEN, KGZ, KHM, KIR, KNA, KOR, KWT, LAO, LBN, LBR, LBY, LCA, LIE, LKA, LSO, LTU, LUX, LVA, MAC, MAF, MAR, MCO, MDA, MDG, MDV, MEX, MHL, MKD, MLI, MLT, MMR, MNE, MNG, MNP, MOZ, MRT, MSR, MTQ, MUS, MWI, MYS, MYT, NAM, NCL, NER, NFK, NGA, NIC, NIU, NLD, NOR, NPL, NRU, NZL, OMN, PAK, PAN, PCN, PER, PHL, PLW, PNG, POL, PRI, PRK, PRT, PRY, PSE, PYF, QAT, REU, ROU, RUS, RWA, SAU, SDN, SEN, SGP, SGS, SHN, SJM, SLB, SLE, SLV, SMR, SOM, SPM, SRB, STP, SUR, SVK, SVN, SWE, SWZ, SYC, SYR, TCA, TCD, TGO, THA, TJK, TKL, TKM, TLS, TON, TTO, TUN, TUR, TUV, TWN, TZA, UGA, UKR, UMI, URY, USA, UZB, VAT, VCT, VEN, VGB, VIR, VNM, VUT, WLF, WSM, YEM, ZAF, ZMB, ZWE

Constant Summary collapse

@@codes =
[]

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.alpha2Object

Returns the value of attribute alpha2.



36
37
38
# File 'lib/iso_country_codes/code.rb', line 36

def alpha2
  @alpha2
end

.alpha3Object

Returns the value of attribute alpha3.



36
37
38
# File 'lib/iso_country_codes/code.rb', line 36

def alpha3
  @alpha3
end

.currenciesObject



50
51
52
53
54
55
56
# File 'lib/iso_country_codes/code.rb', line 50

def currencies
  if defined? @currencies
    return @currencies
  else
    return [@main_currency]
  end
end

.main_currencyObject Also known as: currency

Returns the value of attribute main_currency.



36
37
38
# File 'lib/iso_country_codes/code.rb', line 36

def main_currency
  @main_currency
end

.nameObject

Returns the value of attribute name.



36
37
38
# File 'lib/iso_country_codes/code.rb', line 36

def name
  @name
end

.numericObject

Returns the value of attribute numeric.



36
37
38
# File 'lib/iso_country_codes/code.rb', line 36

def numeric
  @numeric
end

Class Method Details

.allObject



46
47
48
# File 'lib/iso_country_codes/code.rb', line 46

def all
  @@codes.uniq
end

.inherited(code) ⇒ Object

:nodoc:



41
42
43
44
# File 'lib/iso_country_codes/code.rb', line 41

def inherited(code) #:nodoc:
  super
  @@codes << code.instance if self == IsoCountryCodes::Code
end

Instance Method Details

#alpha2Object



15
16
17
# File 'lib/iso_country_codes/code.rb', line 15

def alpha2
  self.class.alpha2
end

#alpha3Object



19
20
21
# File 'lib/iso_country_codes/code.rb', line 19

def alpha3
  self.class.alpha3
end

#currenciesObject



31
32
33
# File 'lib/iso_country_codes/code.rb', line 31

def currencies
  self.class.currencies
end

#currencyObject



27
28
29
# File 'lib/iso_country_codes/code.rb', line 27

def currency
  self.class.currency
end

#main_currencyObject



23
24
25
# File 'lib/iso_country_codes/code.rb', line 23

def main_currency
  self.class.main_currency
end

#nameObject



7
8
9
# File 'lib/iso_country_codes/code.rb', line 7

def name
  self.class.name
end

#numericObject



11
12
13
# File 'lib/iso_country_codes/code.rb', line 11

def numeric
  self.class.numeric
end