ecriso4217 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +2 -2
- data/lib/iso4217/currencies.rb +123 -18
- data/lib/iso4217/iso4217.rb +3 -3
- data/spec/currencies_spec.rb +440 -4
- data/spec/iso4217_spec.rb +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/iso4217/currencies.rb
CHANGED
|
@@ -1,25 +1,130 @@
|
|
|
1
1
|
module ISO4217
|
|
2
2
|
|
|
3
3
|
GENERIC_CURRENCY_SIGN= "U+00a4"
|
|
4
|
-
DOLLAR_SIGN
|
|
4
|
+
DOLLAR_SIGN= "U+0024"
|
|
5
|
+
POUND_SIGN= "U+00a3"
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
CURRENCIES = [
|
|
8
|
+
ALBANIAN_LEKE= Currency.new(:ALL, "U+004cU+0065U+6b", 'Lek'),
|
|
9
|
+
AMERICAN_DOLLAR= Currency.new(:USD, DOLLAR_SIGN, 'US dollar'),
|
|
10
|
+
AFGHANI= Currency.new(:AFN, "U+060b", 'Afghani'),
|
|
11
|
+
ARGENTINA_PESOS= Currency.new(:ARS, "U+0024", 'Argentine peso'),
|
|
12
|
+
ARUBAN_GUILDER= Currency.new(:AWG, "U+0192", 'Aruban guilder'),
|
|
13
|
+
AUSTRALIAN_DOLLAR= Currency.new(:AUD, DOLLAR_SIGN, 'Australian dollar'),
|
|
14
|
+
AZERBAIJANIAN_MANAT= Currency.new(:AZN, "U+043cU+0430U+043d", 'Azerbaijanian manat'),
|
|
15
|
+
BAHAMAS_DOLLAR= Currency.new(:BSD, DOLLAR_SIGN, 'Bahamian dollar'),
|
|
16
|
+
BARBADOS_DOLLAR= Currency.new(:BBD, DOLLAR_SIGN, 'Barbados dollar'),
|
|
17
|
+
BELARUS_RUBLE= Currency.new(:BYR, "U+0070U+002e", 'Belarusian ruble'),
|
|
18
|
+
BELIZE_DOLLAR= Currency.new(:BZD, "U+0042U+005aU+0024", 'Belize dollar'),
|
|
19
|
+
BERMUDA_DOLLARS= Currency.new(:BMD, DOLLAR_SIGN, 'Bermudian dollar'),
|
|
20
|
+
BOLIVIA_BOLIVIANOS= Currency.new(:BOB, "#{DOLLAR_SIGN}U+0062", 'Boliviano'),
|
|
21
|
+
CONVERTIBLE_MARKA= Currency.new(:BAM, "U+004bU+004d", 'Convertible marka'),
|
|
22
|
+
BOTSWANA_PULAS= Currency.new(:BWP, "U+0050", 'Pula'),
|
|
23
|
+
BULGARIAN_LEVA= Currency.new(:BGN, "U+043bU+0432", 'Bulgarian lev'),
|
|
24
|
+
BRAZILIAN_REAL= Currency.new(:BRL, "U+0052#{DOLLAR_SIGN}", 'Brazilian real'),
|
|
25
|
+
BRITAIN_POUND= Currency.new(:GBP, "U+00a3", 'Pound sterling'),
|
|
26
|
+
BRUNEI_DARUSSALAM_DOLLAR= Currency.new(:BND, DOLLAR_SIGN, 'Brunei dollar'),
|
|
27
|
+
CAMBODIAN_RIELS= Currency.new(:KHR, "U+17db", 'Riel'),
|
|
28
|
+
CANADIAN_DOLLAR= Currency.new(:CAD, "CanU+0024", 'Canadian dollar'),
|
|
29
|
+
CAYMAN_ISLANDS_DOLLARS= Currency.new(:KYD, DOLLAR_SIGN, 'Cayman Islands dollar'),
|
|
30
|
+
CHILE_PESOS= Currency.new(:CLP, DOLLAR_SIGN, 'Chilean peso'),
|
|
31
|
+
CHINA_YUAN_RENMINBI= Currency.new(:CNY, "U+00a5", 'Chinese Yuan'),
|
|
32
|
+
COLOMBIAN_PESO= Currency.new(:COP, DOLLAR_SIGN, 'Colombian peso'),
|
|
33
|
+
COSTA_RICA_COLON= Currency.new(:CRC, "U+20a1", 'Costa Rica colon'),
|
|
34
|
+
CROATIAN_KUNA= Currency.new(:HRK, "U+006bU+006e", 'Croatian kuna'),
|
|
35
|
+
CUBA_PESOS= Currency.new(:CUP, "U+20b1", 'Cuban peso'),
|
|
36
|
+
CZECH_KORUNA= Currency.new(:CZK, "U+004bU+010d", 'Czech Koruna'),
|
|
37
|
+
DENMARK_KRONER= Currency.new(:DKK, "U+006bU+0072", 'Danish krone'),
|
|
38
|
+
DOMINICAN_REPUBLIC_PESOS= Currency.new(:DOP, "U+0052U+0044U+0024", 'Dominican peso'),
|
|
39
|
+
EAST_CARIBBEAN_DOLLAR= Currency.new(:XCD, DOLLAR_SIGN, 'East Caribbean dollar'),
|
|
40
|
+
EGYPT_POUND= Currency.new(:EGP, POUND_SIGN, 'Egyptian pound'),
|
|
41
|
+
EL_SALVADOR_COLON= Currency.new(:SVC, DOLLAR_SIGN, 'Salvadoran colón'),
|
|
42
|
+
ESTONIAN_KROONI= Currency.new(:EEK, "U+006bU+0072", 'Kroon'),
|
|
43
|
+
EURO= Currency.new(:EUR, "U+20ac", 'euro'),
|
|
44
|
+
FALKLAND_ISLANDS_POUND= Currency.new(:FKP, POUND_SIGN, 'Falkland Islands pound'),
|
|
45
|
+
FIJI_DOLLAR= Currency.new(:FJD, DOLLAR_SIGN, 'Fiji dollar'),
|
|
46
|
+
GHANA_CEDI= Currency.new(:GHC, "U+00a2", 'Ghanian cedi'),
|
|
47
|
+
GIBRLATAR_POUND= Currency.new(:GIP, POUND_SIGN, 'Gibraltar pound'),
|
|
48
|
+
GUATEMALA_QUEZALES= Currency.new(:GTQ, "U+0051", 'Quezal'),
|
|
49
|
+
GUERNSEY_POUND= Currency.new(:GGP, POUND_SIGN, 'Guernsey pound'),
|
|
50
|
+
GUYANA_DOLLAR= Currency.new(:GYD, DOLLAR_SIGN, 'Guyana dollar'),
|
|
51
|
+
HONDURAS_LEMPIRAS= Currency.new(:HNL, "U+004c", 'Lempira'),
|
|
52
|
+
HONG_KONG_DOLLAR= Currency.new(:HKD, DOLLAR_SIGN, 'Hong Kong dollar'),
|
|
53
|
+
HUNGARY_FLORINT= Currency.new(:HUF, "U+0046U+0074", 'Floringt'),
|
|
54
|
+
ICELAND_KRONUR= Currency.new(:ISK, "U+006bU+0072", 'Iceland krona'),
|
|
55
|
+
INDIAN_RUPEE= Currency.new(:INR, "U+20a8", 'Indian rupee'),
|
|
56
|
+
INDONESIAN_RUPIAH= Currency.new(:IDR, "U+0082U+0112", 'Rupiah'),
|
|
57
|
+
IRAN_RIALS= Currency.new(:IRR, "U+fdfc", 'Iranian rial'),
|
|
58
|
+
ISLE_OF_MAN_POUND= Currency.new(:IMP, POUND_SIGN, 'Pound'),
|
|
59
|
+
ISRAEL_NEW_SHEKEL= Currency.new(:ILS, "U+20aa", 'Israeli new sheqel'),
|
|
60
|
+
JAMAICA_DOLLAR= Currency.new(:JMD, "U+004a#{DOLLAR_SIGN}", 'Jamaican dollar'),
|
|
61
|
+
JAPAN_YEN= Currency.new(:JPY, "U+00a5", 'Japanese yen'),
|
|
62
|
+
JERSEY_POUND= Currency.new(:JEP, POUND_SIGN, 'Jersey pound'),
|
|
63
|
+
KAZAKHSTAN_TENGE= Currency.new(:KZT, "U+043bU+432", 'Tenge'),
|
|
64
|
+
NORTH_KOREAN_WON= Currency.new(:KPW, "U+20a9", 'North Korean won'),
|
|
65
|
+
SOUTH_KOREAN_WON= Currency.new(:KRW, "U+20a9", 'South Korean won'),
|
|
66
|
+
KYRGYZSTAN_SOMS= Currency.new(:KGS, "U+043bU+0432", 'Som'),
|
|
67
|
+
LAOS_KIPS= Currency.new(:LAK, "U+20ad", 'Kip'),
|
|
68
|
+
LATVIAN_LATI= Currency.new(:LVL, "U+004cU+0073", 'Latvian lats'),
|
|
69
|
+
LEBANON_POUND= Currency.new(:LBP, POUND_SIGN, 'Lebanese pound'),
|
|
70
|
+
LIBERIA_DOLLARS= Currency.new(:LRD, DOLLAR_SIGN, 'Liberian dollar'),
|
|
71
|
+
SWITZERLAND_FRANCS= Currency.new(:CHF, "U+0043U+0048U+0046", 'Swiss franc'),
|
|
72
|
+
LITHUANIA_LITAI= Currency.new(:LTL, "U+004cU+0074", 'Lithuanian litas'),
|
|
73
|
+
MACEDONIA_DENARS= Currency.new(:MKD, "U+0434U+0435U+043d", 'Denar'),
|
|
74
|
+
MALAYSIA_RINGGITS= Currency.new(:MYR, "U+0052U+004d", 'Malaysian ringgit'),
|
|
75
|
+
MAURITIUS_RUPEES= Currency.new(:MUR, "U+20a8", 'Mauritius rupee'),
|
|
76
|
+
MEXICO_PESOS= Currency.new(:MXN, DOLLAR_SIGN, 'Mexican peso'),
|
|
77
|
+
MONGOLIA_TUGRIKS= Currency.new(:MNT, "U+20ae", 'Tugrik'),
|
|
78
|
+
MOZAMBIQUE_METICALS= Currency.new(:MZN, "U+004dU+0054", 'Metical'),
|
|
79
|
+
NAMIBIA_DOLLARS= Currency.new(:NAD, DOLLAR_SIGN, 'Namibian dollar'),
|
|
80
|
+
NEPAL_RUPEES= Currency.new(:NPR, "U+20a8", 'Nepalese rupee'),
|
|
81
|
+
NETHERLANDS_ANTILLES_GUILDERS= Currency.new(:ANG, "U+0192", 'Netherlands Antillean gulider'),
|
|
82
|
+
NEW_ZEALAND_DOLLARS= Currency.new(:NZD, DOLLAR_SIGN, 'New Zealand dollar'),
|
|
83
|
+
NICARAGUA_CORDOBAS= Currency.new(:NIO, "U+0043#{DOLLAR_SIGN}", 'Cordoba oro'),
|
|
84
|
+
NIGERIA_NAIRAS= Currency.new(:NGN, "U+20a6", 'Naira'),
|
|
85
|
+
NORWAY_KRONE= Currency.new(:NOK, "U+006bU+0072", 'Norwegian krone'),
|
|
86
|
+
OMAN_RIALS= Currency.new(:OMR, "U+fdfc", 'Rial Omani'),
|
|
87
|
+
PAKISTAN_RUPEES= Currency.new(:PKR, "U+20a8", 'Pakistan rupee'),
|
|
88
|
+
PANAMA_BALBOA= Currency.new(:PAB, "U+0042U+002fU+002e", 'Balboa'),
|
|
89
|
+
PARAGUAY_GUARANI= Currency.new(:PYG, "U+0047U+0073", 'Guarani'),
|
|
90
|
+
PERU_NUEVOS_SOLES= Currency.new(:PEN, "U+0053U+002fU+002e", 'Nuevo sol'),
|
|
91
|
+
PHILIPPINES_PESOS= Currency.new(:PHP, "U+0050U+0068U+0070", 'Philippine peso'),
|
|
92
|
+
POLAND_ZLOTYCH= Currency.new(:PLN, "U+007aU+0142", 'Zloty'),
|
|
93
|
+
QATAR_RIALS= Currency.new(:QAR, "U+fdfc", 'Qatari rial'),
|
|
94
|
+
ROMANIA_NEW_LEI= Currency.new(:RON, "U+006cU+0065U+0069", 'Romanian new leu'),
|
|
95
|
+
RUSSIA_RUBLES= Currency.new(:RUB, "U+0440U+0443U+0432", 'Russian rouble'),
|
|
96
|
+
SAINT_HELENA_POUNDS= Currency.new(:SHP, POUND_SIGN, 'Saint Helena pound'),
|
|
97
|
+
SAUDI_ARABIA_RIYALS= Currency.new(:SAR, "U+fdfc", 'Saudi riyal'),
|
|
98
|
+
SERBIA_DINARS= Currency.new(:RSD, "U+0414U+0438U+043dU+002e", 'Serbian dinar'),
|
|
99
|
+
SEYCHELIES_RUPEES= Currency.new(:SCR, "U+20a8", 'Seychelles rupee'),
|
|
100
|
+
SINGAPORE_DOLLARS= Currency.new(:SGD, DOLLAR_SIGN, 'Singapore dollar'),
|
|
101
|
+
SOLOMON_ISLANDS_DOLLARS= Currency.new(:SBD, DOLLAR_SIGN, 'Solomon Islands dollar'),
|
|
102
|
+
SOMALIA_SHILLINGS= Currency.new(:SOS, "U+0053", 'Somali shilling'),
|
|
103
|
+
SOUTH_AFRICA_RAND= Currency.new(:ZAR, "U+0052", 'South African rand'),
|
|
104
|
+
SRI_LANKA_RUPEES= Currency.new(:LKR, "U+20a8", 'Sri Lanka rupee'),
|
|
105
|
+
SWEDEN_KRONOR= Currency.new(:SEK, "U+006bU+0072", 'Swedish krona/kronor'),
|
|
106
|
+
SURINAME_DOLLARS= Currency.new(:SRD, DOLLAR_SIGN, 'Surinam dollar'),
|
|
107
|
+
SYRIA_POUNDS= Currency.new(:SYP, POUND_SIGN, 'Syrian pound'),
|
|
108
|
+
TAIWAN_NEW_DOLLARS= Currency.new(:TWD, "U+004eU+0054U+0024", 'New Taiwan dollar'),
|
|
109
|
+
THAILAND_BAHT= Currency.new(:THB, "U+0e3f", 'Baht'),
|
|
110
|
+
TRINIDAD_AND_TOBAGO_DOLLARS= Currency.new(:TTD, "U+0054U+0054#{DOLLAR_SIGN}", 'Trinidad and Tobago dollar') ,
|
|
111
|
+
TURKEY_LIRA= Currency.new(:TRY, "U+0054U+004c", 'Turkish lira'),
|
|
112
|
+
TUVALU_DOLLARS= Currency.new(:TVD, DOLLAR_SIGN, 'Tuvalu dollar'),
|
|
113
|
+
UKRAINE_HRYVNIA= Currency.new(:UAH, "U+20b4", 'Hryvina'),
|
|
114
|
+
URUGUAY_PESOS= Currency.new(:UYU, "#{DOLLAR_SIGN}U+0055", 'Peso Uruguayo'),
|
|
115
|
+
UZBEKISTAN_SUMS= Currency.new(:UZS, "U+043bU+0432", 'Uzbekistan som'),
|
|
116
|
+
VENEZUELA_BOLIVARES_FUERTES= Currency.new(:VEF, "U+0042U+0073", 'Venezuelan bolivar fuerte'),
|
|
117
|
+
VIETNAM_DONG= Currency.new(:VND, "U+20ab", 'Vietnamese dong'),
|
|
118
|
+
YEMEN_RIALS= Currency.new(:YER, "U+fdfc", 'Yemeni rial')
|
|
119
|
+
]
|
|
17
120
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
121
|
+
CURRENCY_BY_CODE = Hash.new
|
|
122
|
+
|
|
123
|
+
CURRENCIES.each do |currency|
|
|
124
|
+
CURRENCY_BY_CODE[currency.code.to_s]= currency
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def currency(code)
|
|
128
|
+
CURRENCY_BY_CODE[code.to_s]
|
|
24
129
|
end
|
|
25
130
|
end
|
data/lib/iso4217/iso4217.rb
CHANGED
|
@@ -3,7 +3,7 @@ module ISO4217
|
|
|
3
3
|
COUNTRIES = {
|
|
4
4
|
:BE => EURO,
|
|
5
5
|
:BG => EURO,
|
|
6
|
-
:CA =>
|
|
6
|
+
:CA => CANADIAN_DOLLAR,
|
|
7
7
|
:CZ => EURO,
|
|
8
8
|
:DK => EURO,
|
|
9
9
|
:DE => EURO,
|
|
@@ -12,7 +12,7 @@ module ISO4217
|
|
|
12
12
|
:EL => EURO,
|
|
13
13
|
:ES => EURO,
|
|
14
14
|
:FR => EURO,
|
|
15
|
-
:GB =>
|
|
15
|
+
:GB => BRITAIN_POUND,
|
|
16
16
|
:IT => EURO,
|
|
17
17
|
:CY => EURO,
|
|
18
18
|
:LV => EURO,
|
|
@@ -29,7 +29,7 @@ module ISO4217
|
|
|
29
29
|
:SK => EURO,
|
|
30
30
|
:FI => EURO,
|
|
31
31
|
:SE => EURO,
|
|
32
|
-
:UK =>
|
|
32
|
+
:UK => BRITAIN_POUND,
|
|
33
33
|
:US => AMERICAN_DOLLAR
|
|
34
34
|
}
|
|
35
35
|
|
data/spec/currencies_spec.rb
CHANGED
|
@@ -4,16 +4,452 @@ describe "Currencies" do
|
|
|
4
4
|
include ISO4217
|
|
5
5
|
|
|
6
6
|
context "when searching for a currency" do
|
|
7
|
-
it "returns the
|
|
8
|
-
currency(:
|
|
7
|
+
it "returns the albanian leke" do
|
|
8
|
+
currency(:ALL).should == ISO4217::ALBANIAN_LEKE
|
|
9
9
|
end
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
it "returns the american dollar" do
|
|
12
12
|
currency("USD").should == ISO4217::AMERICAN_DOLLAR
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
it "returns the afghani" do
|
|
16
|
+
currency(:AFN).should == ISO4217::AFGHANI
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "returns the argentinian peso" do
|
|
20
|
+
currency(:ARS).should == ISO4217::ARGENTINA_PESOS
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "returns the arubane guilder" do
|
|
24
|
+
currency(:AWG).should == ISO4217::ARUBAN_GUILDER
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "returns the australian dollar" do
|
|
28
|
+
currency(:AUD).should == ISO4217::AUSTRALIAN_DOLLAR
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "returns the azerbaijanian manat" do
|
|
32
|
+
currency(:AZN).should == ISO4217::AZERBAIJANIAN_MANAT
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "returns the bahamian dollar" do
|
|
36
|
+
currency(:BSD).should == ISO4217::BAHAMAS_DOLLAR
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "returns the barbados dollar" do
|
|
40
|
+
currency(:BBD).should == ISO4217::BARBADOS_DOLLAR
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "returns the belarusian ruble" do
|
|
44
|
+
currency(:BYR).should == ISO4217::BELARUS_RUBLE
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "returns the belize dollar" do
|
|
48
|
+
currency(:BZD).should == ISO4217::BELIZE_DOLLAR
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "returns the bermudian dollar" do
|
|
52
|
+
currency(:BMD).should == ISO4217::BERMUDA_DOLLARS
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "returns the boliviano" do
|
|
56
|
+
currency(:BOB).should == ISO4217::BOLIVIA_BOLIVIANOS
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "returns the convertible marks" do
|
|
60
|
+
currency(:BAM).should == ISO4217::CONVERTIBLE_MARKA
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "returns the pula" do
|
|
64
|
+
currency(:BWP).should == ISO4217::BOTSWANA_PULAS
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "returns the bulgarian lev" do
|
|
68
|
+
currency(:BGN).should == ISO4217::BULGARIAN_LEVA
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "returns the brazilian real" do
|
|
72
|
+
currency(:BRL).should == ISO4217::BRAZILIAN_REAL
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "returns the british pound" do
|
|
76
|
+
currency(:GBP).should == ISO4217::BRITAIN_POUND
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "returns the brunei dollar" do
|
|
80
|
+
currency(:BND).should == ISO4217::BRUNEI_DARUSSALAM_DOLLAR
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "returns the cambodian cambodian riel" do
|
|
84
|
+
currency(:KHR).should == ISO4217::CAMBODIAN_RIELS
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "returns the canadian dollar" do
|
|
88
|
+
currency(:CAD).should == ISO4217::CANADIAN_DOLLAR
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it "returns the Cayman Islands dollar" do
|
|
92
|
+
currency(:KYD).should == ISO4217::CAYMAN_ISLANDS_DOLLARS
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it "returns the chilean peso" do
|
|
96
|
+
currency(:CLP).should == ISO4217::CHILE_PESOS
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it "returns the chinese yuan" do
|
|
100
|
+
currency(:CNY).should == ISO4217::CHINA_YUAN_RENMINBI
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "returns the colombian peso" do
|
|
104
|
+
currency(:COP).should == ISO4217::COLOMBIAN_PESO
|
|
105
|
+
end
|
|
14
106
|
|
|
15
|
-
it "returns the
|
|
107
|
+
it "returns the Costa Rican colon" do
|
|
108
|
+
currency(:CRC).should == ISO4217::COSTA_RICA_COLON
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "returns the croatian kuna" do
|
|
112
|
+
currency(:HRK).should == ISO4217::CROATIAN_KUNA
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it "returns the cuban peso" do
|
|
116
|
+
currency(:CUP).should == ISO4217::CUBA_PESOS
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it "returns the czech koruna" do
|
|
120
|
+
currency(:CZK).should == ISO4217::CZECH_KORUNA
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it "returns the denmark kroner" do
|
|
124
|
+
currency(:DKK).should == ISO4217::DENMARK_KRONER
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "returns the dominican republic peso" do
|
|
128
|
+
currency(:DOP).should == ISO4217::DOMINICAN_REPUBLIC_PESOS
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it "returns the east caribbean dollars" do
|
|
132
|
+
currency(:XCD).should == ISO4217::EAST_CARIBBEAN_DOLLAR
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it "returns the egypt pound" do
|
|
136
|
+
currency(:EGP).should == ISO4217::EGYPT_POUND
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it "returns the salvador colon" do
|
|
140
|
+
currency(:SVC).should == ISO4217::EL_SALVADOR_COLON
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it "returns the estonian krooni" do
|
|
144
|
+
currency(:EEK).should == ISO4217::ESTONIAN_KROONI
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
it "returns the euro " do
|
|
16
148
|
currency(:EUR).should == ISO4217::EURO
|
|
17
149
|
end
|
|
150
|
+
|
|
151
|
+
it "returns the falkland islands pound" do
|
|
152
|
+
currency(:FKP).should == ISO4217::FALKLAND_ISLANDS_POUND
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
it "returns the fiji dollar" do
|
|
156
|
+
currency(:FJD).should == ISO4217::FIJI_DOLLAR
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it "returns the ghana cedi" do
|
|
160
|
+
currency(:GHC).should == ISO4217::GHANA_CEDI
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it "returns the gibraltar pound" do
|
|
164
|
+
currency(:GIP).should == ISO4217::GIBRLATAR_POUND
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
it "returns the guatemala quetzales" do
|
|
168
|
+
currency(:GTQ).should == ISO4217::GUATEMALA_QUEZALES
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "returns the guernsey pound" do
|
|
172
|
+
currency(:GGP).should == ISO4217::GUERNSEY_POUND
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it "returns the guyana dollar" do
|
|
176
|
+
currency(:GYD).should == ISO4217::GUYANA_DOLLAR
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it "returns the honduras lempiras" do
|
|
180
|
+
currency(:HNL).should == ISO4217::HONDURAS_LEMPIRAS
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it "returns the hong kong dollar" do
|
|
184
|
+
currency(:HKD).should == ISO4217::HONG_KONG_DOLLAR
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
it "returns the hungarian florint" do
|
|
188
|
+
currency(:HUF).should == ISO4217::HUNGARY_FLORINT
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
it "returns the icelandic kronur" do
|
|
192
|
+
currency(:ISK).should == ISO4217::ICELAND_KRONUR
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
it "returns the indian rupee" do
|
|
196
|
+
currency(:INR).should == ISO4217::INDIAN_RUPEE
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it "returns the indonesian Rupiah" do
|
|
200
|
+
currency(:IDR).should == ISO4217::INDONESIAN_RUPIAH
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
it "returns the iranian rial" do
|
|
204
|
+
currency(:IRR).should == ISO4217::IRAN_RIALS
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it "returns the isle of man pound" do
|
|
208
|
+
currency(:IMP).should == ISO4217::ISLE_OF_MAN_POUND
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
it "returns the israel new shekel" do
|
|
212
|
+
currency(:ILS).should == ISO4217::ISRAEL_NEW_SHEKEL
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it "returns the jamaica dollar" do
|
|
216
|
+
currency(:JMD).should == ISO4217::JAMAICA_DOLLAR
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
it "returns the japanese jen" do
|
|
220
|
+
currency(:JPY).should == ISO4217::JAPAN_YEN
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
it "returns the jersey pound" do
|
|
224
|
+
currency(:JEP).should == ISO4217::JERSEY_POUND
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "returns the kazakhstan tenge" do
|
|
228
|
+
currency(:KZT).should == ISO4217::KAZAKHSTAN_TENGE
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
it "returns the north korean won" do
|
|
232
|
+
currency(:KPW).should == ISO4217::NORTH_KOREAN_WON
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
it "returns the south korean won" do
|
|
236
|
+
currency(:KRW).should == ISO4217::SOUTH_KOREAN_WON
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
it "returns the kyrgyzstan soms" do
|
|
240
|
+
currency(:KGS).should == ISO4217::KYRGYZSTAN_SOMS
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
it "returns the laos kip" do
|
|
244
|
+
currency(:LAK).should == ISO4217::LAOS_KIPS
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
it "returns the latvian lati" do
|
|
248
|
+
currency(:LVL).should == ISO4217::LATVIAN_LATI
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
it "returns the lebanese pound" do
|
|
252
|
+
currency(:LBP).should == ISO4217::LEBANON_POUND
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
it "returns the liberian dollar" do
|
|
256
|
+
currency(:LRD).should == ISO4217::LIBERIA_DOLLARS
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
it "returns the swiss francs" do
|
|
260
|
+
currency(:CHF).should == ISO4217::SWITZERLAND_FRANCS
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
it "returns the lithuanian litai" do
|
|
264
|
+
currency(:LTL).should == ISO4217::LITHUANIA_LITAI
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
it "returns the macedonian denar" do
|
|
268
|
+
currency(:MKD).should == ISO4217::MACEDONIA_DENARS
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
it "returns the malaysan ringgit" do
|
|
272
|
+
currency(:MYR).should == ISO4217::MALAYSIA_RINGGITS
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
it "returns the mauritius rupee" do
|
|
276
|
+
currency(:MUR).should == ISO4217::MAURITIUS_RUPEES
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
it "returns the mexican peso" do
|
|
280
|
+
currency(:MXN).should == ISO4217::MEXICO_PESOS
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
it "returns the mongolian tugrik" do
|
|
284
|
+
currency(:MNT).should == ISO4217::MONGOLIA_TUGRIKS
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
it "returns the mozambique metical" do
|
|
288
|
+
currency(:MZN).should == ISO4217::MOZAMBIQUE_METICALS
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
it "returns the namibian dollar" do
|
|
292
|
+
currency(:NAD).should == ISO4217::NAMIBIA_DOLLARS
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
it "returns the nepal rupee" do
|
|
296
|
+
currency(:NPR).should == ISO4217::NEPAL_RUPEES
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
it "returns the netherland antilles guilders" do
|
|
300
|
+
currency(:ANG).should == ISO4217::NETHERLANDS_ANTILLES_GUILDERS
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
it "returns the new zealand dollar" do
|
|
304
|
+
currency(:NZD).should == ISO4217::NEW_ZEALAND_DOLLARS
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
it "returns the nicaraguan cordoba" do
|
|
308
|
+
currency(:NIO).should == ISO4217::NICARAGUA_CORDOBAS
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
it "returns the nigerian naira" do
|
|
312
|
+
currency(:NGN).should == ISO4217::NIGERIA_NAIRAS
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
it "returns the norwegian krone" do
|
|
316
|
+
currency(:NOK).should == ISO4217::NORWAY_KRONE
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
it "returns the oman rial" do
|
|
320
|
+
currency(:OMR).should == ISO4217::OMAN_RIALS
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
it "returns the pakistan rupee" do
|
|
324
|
+
currency(:PKR).should == ISO4217::PAKISTAN_RUPEES
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
it "returns the panaman balboa" do
|
|
328
|
+
currency(:PAB).should == ISO4217::PANAMA_BALBOA
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
it "returns the paraguayan guarani" do
|
|
332
|
+
currency(:PYG).should == ISO4217::PARAGUAY_GUARANI
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
it "returns the peruvian nuevo soles" do
|
|
336
|
+
currency(:PEN).should == ISO4217::PERU_NUEVOS_SOLES
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
it "returns the philippines peso" do
|
|
340
|
+
currency(:PHP).should == ISO4217::PHILIPPINES_PESOS
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
it "returns the polish zlotych" do
|
|
344
|
+
currency(:PLN).should == ISO4217::POLAND_ZLOTYCH
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
it "returns the qatar rials" do
|
|
348
|
+
currency(:QAR).should == ISO4217::QATAR_RIALS
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
it "returns the romanian new lei" do
|
|
352
|
+
currency(:RON).should == ISO4217::ROMANIA_NEW_LEI
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
it "returns the russian ruble" do
|
|
356
|
+
currency(:RUB).should == ISO4217::RUSSIA_RUBLES
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
it "returns the saint helena pound" do
|
|
360
|
+
currency(:SHP).should == ISO4217::SAINT_HELENA_POUNDS
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
it "returns the saudi arabian riyal" do
|
|
364
|
+
currency(:SAR).should == ISO4217::SAUDI_ARABIA_RIYALS
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
it "returns the serbian dinar" do
|
|
368
|
+
currency(:RSD).should == ISO4217::SERBIA_DINARS
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
it "returns the seychelies rupee" do
|
|
372
|
+
currency(:SCR).should == ISO4217::SEYCHELIES_RUPEES
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
it "returns the singapore dollar" do
|
|
376
|
+
currency(:SGD).should == ISO4217::SINGAPORE_DOLLARS
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
it "returns the solomon islands dollar" do
|
|
380
|
+
currency(:SBD).should == ISO4217::SOLOMON_ISLANDS_DOLLARS
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
it "returns the somalia shilling" do
|
|
384
|
+
currency(:SOS).should == ISO4217::SOMALIA_SHILLINGS
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
it "returns the south african rand" do
|
|
388
|
+
currency(:ZAR).should == ISO4217::SOUTH_AFRICA_RAND
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
it "returns the sri lanka rupee" do
|
|
392
|
+
currency(:LKR).should == ISO4217::SRI_LANKA_RUPEES
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
it "returns the swedish kronor" do
|
|
396
|
+
currency(:SEK).should == ISO4217::SWEDEN_KRONOR
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
it "returns the swiss frnac" do
|
|
400
|
+
currency(:CHF).should == ISO4217::SWITZERLAND_FRANCS
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
it "returns the suriname dollar" do
|
|
404
|
+
currency(:SRD).should == ISO4217::SURINAME_DOLLARS
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
it "returns the syirian pound" do
|
|
408
|
+
currency(:SYP).should == ISO4217::SYRIA_POUNDS
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
it "returns the taiwanese new dollar" do
|
|
412
|
+
currency(:TWD).should == ISO4217::TAIWAN_NEW_DOLLARS
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
it "returns the thailand baht" do
|
|
416
|
+
currency(:THB).should == ISO4217::THAILAND_BAHT
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
it "returns the trinidad and tobago dollar" do
|
|
420
|
+
currency(:TTD).should == ISO4217::TRINIDAD_AND_TOBAGO_DOLLARS
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
it "returns the turkish lira" do
|
|
424
|
+
currency(:TRY).should == ISO4217::TURKEY_LIRA
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
it "returns the tuvalu dollar" do
|
|
428
|
+
currency(:TVD).should == ISO4217::TUVALU_DOLLARS
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
it "returns the ukraine hryvnia" do
|
|
432
|
+
currency(:UAH).should == ISO4217::UKRAINE_HRYVNIA
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
it "returns the uruguay peso" do
|
|
436
|
+
currency(:UYU).should == ISO4217::URUGUAY_PESOS
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
it "returns the uzbekistan sums" do
|
|
440
|
+
currency(:UZS).should == ISO4217::UZBEKISTAN_SUMS
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
it "returns the venezuelan bolivar fuerte" do
|
|
444
|
+
currency(:VEF).should == ISO4217::VENEZUELA_BOLIVARES_FUERTES
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
it "returns the vietnamese dong" do
|
|
448
|
+
currency(:VND).should == ISO4217::VIETNAM_DONG
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
it "returns the yemen rials" do
|
|
452
|
+
currency(:YER).should == ISO4217::YEMEN_RIALS
|
|
453
|
+
end
|
|
18
454
|
end
|
|
19
455
|
end
|
data/spec/iso4217_spec.rb
CHANGED
|
@@ -70,7 +70,7 @@ describe ISO4217 do
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it "returns the currency object for GBP when searching for the currency in Great Britain" do
|
|
73
|
-
[:GB, :UK].each {|country| currency_for(country).should == ISO4217::
|
|
73
|
+
[:GB, :UK].each {|country| currency_for(country).should == ISO4217::BRITAIN_POUND}
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it "returns the currency object for the dollar if searching for the American currency" do
|
|
@@ -88,7 +88,7 @@ describe ISO4217 do
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
it "returns the (human readable) name of the pound sterling" do
|
|
91
|
-
ISO4217::
|
|
91
|
+
ISO4217::BRITAIN_POUND.name.should == 'Pound sterling'
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "returns the (human readable) name of the US dollar" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ecriso4217
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Enrique Comba Riepenhausen
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-10-
|
|
12
|
+
date: 2009-10-10 00:00:00 +01:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|