Class: CountryCurrency::Code

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/country_currency/code.rb,
lib/country_currency/calling.rb,
lib/country_currency/iso_4217.rb,
lib/country_currency/continent.rb,
lib/country_currency/iso_3166_1.rb,
lib/country_currency/iso_13616_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

.alpha2Object

Returns the value of attribute alpha2.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def alpha2
  @alpha2
end

.alpha3Object

Returns the value of attribute alpha3.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def alpha3
  @alpha3
end

.callingObject Also known as: calling_code

Returns the value of attribute calling.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def calling
  @calling
end

.continentObject

Returns the value of attribute continent.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def continent
  @continent
end

.currenciesObject



76
77
78
79
80
81
82
# File 'lib/country_currency/code.rb', line 76

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

.currency_symbolObject

Returns the value of attribute currency_symbol.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def currency_symbol
  @currency_symbol
end

.ibanObject



84
85
86
87
# File 'lib/country_currency/code.rb', line 84

def iban
  # Return `nil` if the country doesn't use IBANs
  return @iban if defined? @iban
end

.main_currencyObject Also known as: currency

Returns the value of attribute main_currency.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def main_currency
  @main_currency
end

.nameObject

Returns the value of attribute name.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def name
  @name
end

.numericObject

Returns the value of attribute numeric.



57
58
59
# File 'lib/country_currency/code.rb', line 57

def numeric
  @numeric
end

Class Method Details

.allObject



68
69
70
# File 'lib/country_currency/code.rb', line 68

def all
  @@codes.uniq
end

.for_select(type = :alpha2) ⇒ Object



72
73
74
# File 'lib/country_currency/code.rb', line 72

def for_select(type = :alpha2)
  all.map { |country| [country.name, country.send(type)] }
end

.inherited(code) ⇒ Object

:nodoc:



63
64
65
66
# File 'lib/country_currency/code.rb', line 63

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

Instance Method Details

#alpha2Object



16
17
18
# File 'lib/country_currency/code.rb', line 16

def alpha2
  self.class.alpha2
end

#alpha3Object



20
21
22
# File 'lib/country_currency/code.rb', line 20

def alpha3
  self.class.alpha3
end

#callingObject



24
25
26
# File 'lib/country_currency/code.rb', line 24

def calling
  self.class.calling
end

#calling_codeObject



28
29
30
# File 'lib/country_currency/code.rb', line 28

def calling_code
  self.class.calling_code
end

#continentObject



32
33
34
# File 'lib/country_currency/code.rb', line 32

def continent
  self.class.continent
end

#currenciesObject



44
45
46
# File 'lib/country_currency/code.rb', line 44

def currencies
  self.class.currencies
end

#currencyObject



40
41
42
# File 'lib/country_currency/code.rb', line 40

def currency
  self.class.currency
end

#currency_symbolObject



48
49
50
# File 'lib/country_currency/code.rb', line 48

def currency_symbol
  self.class.currency_symbol
end

#ibanObject



52
53
54
# File 'lib/country_currency/code.rb', line 52

def iban
  self.class.iban
end

#main_currencyObject



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

def main_currency
  self.class.main_currency
end

#nameObject



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

def name
  self.class.name
end

#numericObject Also known as: code



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

def numeric
  self.class.numeric
end