Class: IsoCountryCodes::Code
- Inherits:
-
Object
- Object
- IsoCountryCodes::Code
show all
- Includes:
- Singleton
- Defined in:
- lib/iso_country_codes/code.rb,
lib/iso_country_codes/calling.rb,
lib/iso_country_codes/iso_4217.rb,
lib/iso_country_codes/continent.rb,
lib/iso_country_codes/iso_3166_1.rb
Direct Known Subclasses
ABW, AFG, AGO, AIA, ALA, ALB, AND, ARE, ARG, ARM, ASM, ATA, ATF, ATG, AUS, AUT, AZE, BDI, BEL, BEN, BES, 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, CUW, 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, SSD, STP, SUR, SVK, SVN, SWE, SWZ, SXM, 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, ARE, ARG, ARM, ASM, ATA, ATF, ATG, AUS, AUT, AZE, BDI, BEL, BEN, BES, 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, CUW, 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, SSD, STP, SUR, SVK, SVN, SWE, SWZ, SXM, 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
.alpha2 ⇒ Object
Returns the value of attribute alpha2.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def alpha2
@alpha2
end
|
.alpha3 ⇒ Object
Returns the value of attribute alpha3.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def alpha3
@alpha3
end
|
.calling ⇒ Object
Also known as:
calling_code
Returns the value of attribute calling.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def calling
@calling
end
|
.continent ⇒ Object
Returns the value of attribute continent.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def continent
@continent
end
|
.currencies ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/iso_country_codes/code.rb', line 67
def currencies
if defined? @currencies
return @currencies
else
return [@main_currency]
end
end
|
.main_currency ⇒ Object
Also known as:
currency
Returns the value of attribute main_currency.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def main_currency
@main_currency
end
|
.name ⇒ Object
Returns the value of attribute name.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def name
@name
end
|
.numeric ⇒ Object
Returns the value of attribute numeric.
48
49
50
|
# File 'lib/iso_country_codes/code.rb', line 48
def numeric
@numeric
end
|
Class Method Details
.all ⇒ Object
59
60
61
|
# File 'lib/iso_country_codes/code.rb', line 59
def all
@@codes.uniq
end
|
.for_select(type = :alpha2) ⇒ Object
63
64
65
|
# File 'lib/iso_country_codes/code.rb', line 63
def for_select(type = :alpha2)
all.map { |country| [country.name, country.send(type)] }
end
|
.inherited(code) ⇒ Object
54
55
56
57
|
# File 'lib/iso_country_codes/code.rb', line 54
def inherited(code) super
@@codes << code.instance if self == IsoCountryCodes::Code
end
|
Instance Method Details
#alpha2 ⇒ Object
15
16
17
|
# File 'lib/iso_country_codes/code.rb', line 15
def alpha2
self.class.alpha2
end
|
#alpha3 ⇒ Object
19
20
21
|
# File 'lib/iso_country_codes/code.rb', line 19
def alpha3
self.class.alpha3
end
|
#calling ⇒ Object
23
24
25
|
# File 'lib/iso_country_codes/code.rb', line 23
def calling
self.class.calling
end
|
#calling_code ⇒ Object
27
28
29
|
# File 'lib/iso_country_codes/code.rb', line 27
def calling_code
self.class.calling_code
end
|
#continent ⇒ Object
31
32
33
|
# File 'lib/iso_country_codes/code.rb', line 31
def continent
self.class.continent
end
|
#currencies ⇒ Object
43
44
45
|
# File 'lib/iso_country_codes/code.rb', line 43
def currencies
self.class.currencies
end
|
#currency ⇒ Object
39
40
41
|
# File 'lib/iso_country_codes/code.rb', line 39
def currency
self.class.currency
end
|
#main_currency ⇒ Object
35
36
37
|
# File 'lib/iso_country_codes/code.rb', line 35
def main_currency
self.class.main_currency
end
|
#name ⇒ Object
7
8
9
|
# File 'lib/iso_country_codes/code.rb', line 7
def name
self.class.name
end
|
#numeric ⇒ Object
11
12
13
|
# File 'lib/iso_country_codes/code.rb', line 11
def numeric
self.class.numeric
end
|