bucks 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +18 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/lib/bucks.rb +1 -0
- data/lib/bucks/currency.rb +360 -0
- data/test/bucks/test_currency.rb +13 -0
- data/test/helper.rb +17 -0
- metadata +119 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.5.1"
|
11
|
+
gem "rcov", ">= 0"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.5.1)
|
6
|
+
bundler (~> 1.0.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.8.7)
|
10
|
+
rcov (0.9.9)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bundler (~> 1.0.0)
|
17
|
+
jeweler (~> 1.5.1)
|
18
|
+
rcov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Andrés Mejía
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= bucks
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to bucks
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Andrés Mejía. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
require 'rake'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = "bucks"
|
17
|
+
gem.homepage = "http://github.com/andmej/bucks"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{Find the currency used in any country in the world}
|
20
|
+
gem.description = %Q{Find the currency used in any country in the world}
|
21
|
+
gem.email = "andmej@gmail.com"
|
22
|
+
gem.authors = ["Andrés Mejía"]
|
23
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
24
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
25
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
26
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
Rake::TestTask.new(:test) do |test|
|
32
|
+
test.libs << 'lib' << 'test'
|
33
|
+
test.pattern = 'test/**/test_*.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'rcov/rcovtask'
|
38
|
+
Rcov::RcovTask.new do |test|
|
39
|
+
test.libs << 'test'
|
40
|
+
test.pattern = 'test/**/test_*.rb'
|
41
|
+
test.verbose = true
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => :test
|
45
|
+
|
46
|
+
require 'rake/rdoctask'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "bucks #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/bucks.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bucks/currency'
|
@@ -0,0 +1,360 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Bucks
|
3
|
+
class Currency
|
4
|
+
CURRENCIES = {
|
5
|
+
"Afghanistan" => :AFN,
|
6
|
+
"Aland Islands" => :EUR,
|
7
|
+
"Albania" => :ALL,
|
8
|
+
"Algeria" => :DZD,
|
9
|
+
"United States" => :USD,
|
10
|
+
"American Samoa" => :USD,
|
11
|
+
"American Virgin Islands" => :USD,
|
12
|
+
"Andorra" => :EUR,
|
13
|
+
"Angola" => :AOA,
|
14
|
+
"Anguilla" => :XCD,
|
15
|
+
"Antarctica" => :USD,
|
16
|
+
"Antigua And Barbuda" => :XCD,
|
17
|
+
"Argentina" => :ARS,
|
18
|
+
"Armenia" => :AMD,
|
19
|
+
"Aruba" => :AWG,
|
20
|
+
"Australia" => :AUD,
|
21
|
+
"Austria" => :EUR,
|
22
|
+
"Azerbaijan" => :AZN,
|
23
|
+
"Azores" => :EUR,
|
24
|
+
"Bahamas" => :BSD,
|
25
|
+
"Bahrain" => :BHD,
|
26
|
+
"Baleares (Balearic Islands)" => :EUR,
|
27
|
+
"Bangladesh" => :BDT,
|
28
|
+
"Barbados" => :BBD,
|
29
|
+
"Barbuda and Antigua" => :XCD,
|
30
|
+
"Belarus" => :BYR,
|
31
|
+
"Belgium" => :EUR,
|
32
|
+
"Belize" => :BZD,
|
33
|
+
"Benin" => :XOF,
|
34
|
+
"Bermuda" => :BMD,
|
35
|
+
"Bhutan" => :BTN,
|
36
|
+
"Bhutan" => :INR,
|
37
|
+
"Bolivia" => :BOB,
|
38
|
+
"Bonaire" => :ANG,
|
39
|
+
"Bosnia and Herzegovina" => :BAM,
|
40
|
+
"Botswana" => :BWP,
|
41
|
+
"Bouvet Island" => :NOK,
|
42
|
+
"Brazil" => :BRL,
|
43
|
+
"Britain (United Kingdom)" => :GBP,
|
44
|
+
"British Indian Ocean Territory" => :USD,
|
45
|
+
"British Virgin Islands" => :USD,
|
46
|
+
"Brunei Darussalam" => :BND,
|
47
|
+
"Bulgaria" => :BGN,
|
48
|
+
"Burkina Faso" => :XOF,
|
49
|
+
"Burma (Myanmar)" => :MMK,
|
50
|
+
"Burundi" => :BIF,
|
51
|
+
"Cote d'Ivoire" => :XOF,
|
52
|
+
"Caicos and Turks Islands" => :USD,
|
53
|
+
"Cambodia" => :KHR,
|
54
|
+
"Cameroon" => :XAF,
|
55
|
+
"Canada" => :CAD,
|
56
|
+
"Canary Islands" => :EUR,
|
57
|
+
"Cape Verde" => :CVE,
|
58
|
+
"Cayman Islands" => :KYD,
|
59
|
+
"Central African Republic" => :XAF,
|
60
|
+
"Chad" => :XAF,
|
61
|
+
"Chile" => :CLP,
|
62
|
+
"China" => :CNY,
|
63
|
+
"Christmas Island" => :AUD,
|
64
|
+
"Cocos (Keeling) Islands" => :AUD,
|
65
|
+
"Colombia" => :COP,
|
66
|
+
"Communauté Financière Africaine (CFA)" => :XAF,
|
67
|
+
"Comoros" => :KMF,
|
68
|
+
"Comptoirs Français du Pacifique (CFP)" => :XPF,
|
69
|
+
"Congo" => :XAF,
|
70
|
+
"Congo, the Democratic Republic of the" => :CDF,
|
71
|
+
"Cook Islands" => :NZD,
|
72
|
+
"Costa Rica" => :CRC,
|
73
|
+
"Croatia" => :HRK,
|
74
|
+
"Cuba" => :CUP,
|
75
|
+
"Curaço" => :ANG,
|
76
|
+
"Cyprus" => :EUR,
|
77
|
+
"Cyprus" => :CYP,
|
78
|
+
"Czech Republic" => :CZK,
|
79
|
+
"Denmark" => :DKK,
|
80
|
+
"Djibouti" => :DJF,
|
81
|
+
"Dominica" => :XCD,
|
82
|
+
"Dominican Republic" => :DOP,
|
83
|
+
"Dutch (Netherlands)" => :EUR,
|
84
|
+
"East Timor" => :IDR,
|
85
|
+
"Ecuador" => :USD,
|
86
|
+
"Egypt" => :EGP,
|
87
|
+
"Ireland" => :EUR,
|
88
|
+
"El Salvador" => :SVC,
|
89
|
+
"El Salvador" => :USD,
|
90
|
+
"England (United Kingdom)" => :GBP,
|
91
|
+
"Equatorial Guinea" => :XAF,
|
92
|
+
"Eritrea" => :ETB,
|
93
|
+
"Eritrea" => :ERN,
|
94
|
+
"Estonia" => :EEK,
|
95
|
+
"Ethiopia" => :ETB,
|
96
|
+
"Euro Member Countries" => :EUR,
|
97
|
+
"Falkland Islands (Malvinas)" => :FKP,
|
98
|
+
"Faroe Islands" => :DKK,
|
99
|
+
"Fiji" => :FJD,
|
100
|
+
"Finland" => :EUR,
|
101
|
+
"France" => :EUR,
|
102
|
+
"French Guiana" => :EUR,
|
103
|
+
"French Pacific Islands" => :XPF,
|
104
|
+
"French Polynesia" => :XPF,
|
105
|
+
"French Southern Territories" => :EUR,
|
106
|
+
"Futuna and Wallis Islands" => :XPF,
|
107
|
+
"Gabon" => :XAF,
|
108
|
+
"Gambia" => :GMD,
|
109
|
+
"Georgia" => :GEL,
|
110
|
+
"Germany" => :EUR,
|
111
|
+
"Ghana" => :GHS,
|
112
|
+
"Gibraltar" => :GIP,
|
113
|
+
"Gold" => :XAU,
|
114
|
+
"Great Britain (United Kingdom)" => :GBP,
|
115
|
+
"Greece" => :EUR,
|
116
|
+
"Greenland" => :DKK,
|
117
|
+
"Grenada" => :XCD,
|
118
|
+
"Saint Vincent and the Grenadines" => :XCD,
|
119
|
+
"Guadeloupe" => :EUR,
|
120
|
+
"Guam" => :USD,
|
121
|
+
"Guatemala" => :GTQ,
|
122
|
+
"Guernsey" => :GGP,
|
123
|
+
"Guinea" => :GNF,
|
124
|
+
"Guinea-Bissau" => :XOF,
|
125
|
+
"Guyana" => :GYD,
|
126
|
+
"Haiti" => :HTG,
|
127
|
+
"Haiti" => :USD,
|
128
|
+
"Heard Island and McDonald Islands" => :AUD,
|
129
|
+
"Bosnia and Herzegowina" => :BAM,
|
130
|
+
"Holland (Netherlands)" => :EUR,
|
131
|
+
"Holy See (Vatican City State)" => :EUR,
|
132
|
+
"Honduras" => :HNL,
|
133
|
+
"Hong Kong" => :HKD,
|
134
|
+
"Hungary" => :HUF,
|
135
|
+
"Iceland" => :ISK,
|
136
|
+
"India" => :INR,
|
137
|
+
"Indonesia" => :IDR,
|
138
|
+
"International Monetary Fund (IMF)" => :XDR,
|
139
|
+
"Iran, Islamic Republic of" => :IRR,
|
140
|
+
"Iraq" => :IQD,
|
141
|
+
"Ireland (Eire)" => :EUR,
|
142
|
+
"Isle of Man" => :IMP,
|
143
|
+
"Israel" => :ILS,
|
144
|
+
"Italy" => :EUR,
|
145
|
+
"Jamaica" => :JMD,
|
146
|
+
"Jan Mayen and Svalbard" => :NOK,
|
147
|
+
"Japan" => :JPY,
|
148
|
+
"Jersey" => :JEP,
|
149
|
+
"Jordan" => :JOD,
|
150
|
+
"Kazakhstan" => :KZT,
|
151
|
+
"Keeling (Cocos) Islands" => :AUD,
|
152
|
+
"Kenya" => :KES,
|
153
|
+
"Kiribati" => :AUD,
|
154
|
+
"Korea, Democratic People's Republic of" => :KPW,
|
155
|
+
"Korea, Republic of" => :KRW,
|
156
|
+
"Kuwait" => :KWD,
|
157
|
+
"Kyrgyzstan" => :KGS,
|
158
|
+
"Lao People's Democratic Republic" => :LAK,
|
159
|
+
"Latvia" => :LVL,
|
160
|
+
"Lebanon" => :LBP,
|
161
|
+
"Lesotho" => :LSL,
|
162
|
+
"Lesotho" => :ZAR,
|
163
|
+
"Liberia" => :LRD,
|
164
|
+
"Libya" => :LYD,
|
165
|
+
"Libyan Arab Jamahiriya" => :LYD,
|
166
|
+
"Liechtenstein" => :CHF,
|
167
|
+
"Lithuania" => :LTL,
|
168
|
+
"Luxembourg" => :EUR,
|
169
|
+
"Macao" => :MOP,
|
170
|
+
"Macedonia, The Former Yugoslav Republic Of" => :MKD,
|
171
|
+
"Madagascar" => :MGA,
|
172
|
+
"Madeira Islands" => :EUR,
|
173
|
+
"Malawi" => :MWK,
|
174
|
+
"Malaysia" => :MYR,
|
175
|
+
"Maldives" => :MVR,
|
176
|
+
"Mali" => :XOF,
|
177
|
+
"Malta" => :EUR,
|
178
|
+
"Malvinas (Falkland Islands)" => :FKP,
|
179
|
+
"Mariana Islands (Northern)" => :USD,
|
180
|
+
"Marshall Islands" => :USD,
|
181
|
+
"Martinique" => :EUR,
|
182
|
+
"Mauritania" => :MRO,
|
183
|
+
"Mauritius" => :MUR,
|
184
|
+
"Mayotte" => :EUR,
|
185
|
+
"Heard and McDonald Islands" => :AUD,
|
186
|
+
"Mexico" => :MXN,
|
187
|
+
"Micronesia, Federated States of" => :USD,
|
188
|
+
"Midway Islands" => :USD,
|
189
|
+
"Miquelon and Saint Pierre" => :EUR,
|
190
|
+
"Moldova, Republic of" => :MDL,
|
191
|
+
"Monaco" => :EUR,
|
192
|
+
"Mongolia" => :MNT,
|
193
|
+
"Montenegro" => :EUR,
|
194
|
+
"Montserrat" => :XCD,
|
195
|
+
"Morocco" => :MAD,
|
196
|
+
"Mozambique" => :MZN,
|
197
|
+
"Myanmar" => :MMK,
|
198
|
+
"Namibia" => :NAD,
|
199
|
+
"Namibia" => :ZAR,
|
200
|
+
"Nauru" => :AUD,
|
201
|
+
"Nepal" => :NPR,
|
202
|
+
"Netherlands Antilles" => :ANG,
|
203
|
+
"Netherlands" => :EUR,
|
204
|
+
"Nevis and Saint Kitts" => :XCD,
|
205
|
+
"New Caledonia" => :XPF,
|
206
|
+
"New Zealand" => :NZD,
|
207
|
+
"Nicaragua" => :NIO,
|
208
|
+
"Niger" => :XOF,
|
209
|
+
"Nigeria" => :NGN,
|
210
|
+
"Niue" => :NZD,
|
211
|
+
"Norfolk Island" => :AUD,
|
212
|
+
"Northern Mariana Islands" => :USD,
|
213
|
+
"Norway" => :NOK,
|
214
|
+
"Oman" => :OMR,
|
215
|
+
"Pakistan" => :PKR,
|
216
|
+
"Palau" => :USD,
|
217
|
+
"Palestinian Territory, Occupied" => :NIS,
|
218
|
+
"Palladium" => :XPD,
|
219
|
+
"Panama" => :PAB,
|
220
|
+
"Panama" => :USD,
|
221
|
+
"Papua New Guinea" => :PGK,
|
222
|
+
"Paraguay" => :PYG,
|
223
|
+
"Peru" => :PEN,
|
224
|
+
"Philippines" => :PHP,
|
225
|
+
"Pitcairn" => :NZD,
|
226
|
+
"Platinum" => :XPT,
|
227
|
+
"Poland" => :PLN,
|
228
|
+
"Portugal" => :EUR,
|
229
|
+
"Sao Tome and Principe" => :STD,
|
230
|
+
"Puerto Rico" => :USD,
|
231
|
+
"Qatar" => :QAR,
|
232
|
+
"Reunion" => :EUR,
|
233
|
+
"Romania" => :RON,
|
234
|
+
"Russian Federation" => :RUB,
|
235
|
+
"Rwanda" => :RWF,
|
236
|
+
"São Tome and Principe" => :STD,
|
237
|
+
"Saba" => :ANG,
|
238
|
+
"Sahara (Western)" => :MAD,
|
239
|
+
"Saint Barthelemy" => :EUR,
|
240
|
+
"Saint Christopher" => :XCD,
|
241
|
+
"Saint Helena" => :SHP,
|
242
|
+
"Saint Kitts and Nevis" => :XCD,
|
243
|
+
"Saint Lucia" => :XCD,
|
244
|
+
"Saint Pierre and Miquelon" => :EUR,
|
245
|
+
"Saint Vincent and The Grenadines" => :XCD,
|
246
|
+
"Saint-Martin" => :EUR,
|
247
|
+
"Samoa (American)" => :USD,
|
248
|
+
"Samoa" => :WST,
|
249
|
+
"San Marino" => :EUR,
|
250
|
+
"Saudi Arabia" => :SAR,
|
251
|
+
"Seborga" => :SPL,
|
252
|
+
"Senegal" => :XOF,
|
253
|
+
"Serbia" => :RSD,
|
254
|
+
"Seychelles" => :SCR,
|
255
|
+
"Sierra Leone" => :SLL,
|
256
|
+
"Silver" => :XAG,
|
257
|
+
"Singapore" => :SGD,
|
258
|
+
"Sint Eustatius" => :ANG,
|
259
|
+
"Sint Maarten" => :ANG,
|
260
|
+
"Slovakia" => :EUR,
|
261
|
+
"Slovenia" => :EUR,
|
262
|
+
"Solomon Islands" => :SBD,
|
263
|
+
"Somalia" => :SOS,
|
264
|
+
"South Africa" => :ZAR,
|
265
|
+
"South Georgia and the South Sandwich Islands" => :GBP,
|
266
|
+
"Spain" => :EUR,
|
267
|
+
"Sri Lanka" => :LKR,
|
268
|
+
"Sudan" => :SDG,
|
269
|
+
"Suriname" => :SRD,
|
270
|
+
"Svalbard and Jan Mayen" => :NOK,
|
271
|
+
"Swaziland" => :SZL,
|
272
|
+
"Sweden" => :SEK,
|
273
|
+
"Switzerland" => :CHF,
|
274
|
+
"Syria" => :SYP,
|
275
|
+
"Syrian Arab Republic" => :SYP,
|
276
|
+
"Taiwan, Province of China" => :TWD,
|
277
|
+
"Tajikistan" => :RUB,
|
278
|
+
"Tajikistan" => :TJS,
|
279
|
+
"Tanzania, United Republic of" => :TZS,
|
280
|
+
"Thailand" => :THB,
|
281
|
+
"Timor-Leste" => :IDR,
|
282
|
+
"Tobago and Trinidad" => :TTD,
|
283
|
+
"Togo" => :XOF,
|
284
|
+
"Tokelau" => :NZD,
|
285
|
+
"Tonga" => :TOP,
|
286
|
+
"Trinidad and Tobago" => :TTD,
|
287
|
+
"Tunisia" => :TND,
|
288
|
+
"Turkey" => :TRY,
|
289
|
+
"Turkmenistan" => :TMM,
|
290
|
+
"Turks and Caicos Islands" => :USD,
|
291
|
+
"Tuvalu" => :TVD,
|
292
|
+
"Uganda" => :UGX,
|
293
|
+
"Ukraine" => :UAH,
|
294
|
+
"United Arab Emirates" => :AED,
|
295
|
+
"United Kingdom" => :GBP,
|
296
|
+
"United States Minor Outlying Islands" => :USD,
|
297
|
+
"United States of America" => :USD,
|
298
|
+
"Uruguay" => :UYU,
|
299
|
+
"US Virgin Islands" => :USD,
|
300
|
+
"Uzbekistan" => :UZS,
|
301
|
+
"Vanuatu" => :VUV,
|
302
|
+
"Vatican City (The Holy See)" => :EUR,
|
303
|
+
"Venezuela" => :VEB,
|
304
|
+
"Venezuela" => :VEF,
|
305
|
+
"Viet Nam" => :VND,
|
306
|
+
"Virgin Islands, U.S." => :USD,
|
307
|
+
"Virgin Islands, British" => :USD,
|
308
|
+
"Wake Island" => :USD,
|
309
|
+
"Wallis and Futuna" => :XPF,
|
310
|
+
"Western Sahara" => :MAD,
|
311
|
+
"Yemen" => :YER,
|
312
|
+
"Zambia" => :ZMK,
|
313
|
+
"Zimbabwe" => :ZWD,
|
314
|
+
}
|
315
|
+
|
316
|
+
COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
|
317
|
+
"Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
|
318
|
+
"Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
|
319
|
+
"Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil",
|
320
|
+
"British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
|
321
|
+
"Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
|
322
|
+
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
|
323
|
+
"Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
|
324
|
+
"Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt",
|
325
|
+
"El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)",
|
326
|
+
"Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia",
|
327
|
+
"French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea",
|
328
|
+
"Guinea-Bissau", "Guyana", "Haiti", "Heard and McDonald Islands", "Holy See (Vatican City State)",
|
329
|
+
"Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
|
330
|
+
"Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
|
331
|
+
"Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
|
332
|
+
"Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya",
|
333
|
+
"Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
|
334
|
+
"Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
|
335
|
+
"Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
|
336
|
+
"Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
|
337
|
+
"Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger",
|
338
|
+
"Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
|
339
|
+
"Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
340
|
+
"Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
|
341
|
+
"Rwanda", "Saint Barthelemy", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia",
|
342
|
+
"Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
|
343
|
+
"Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
|
344
|
+
"Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
|
345
|
+
"South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname",
|
346
|
+
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
|
347
|
+
"Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
|
348
|
+
"Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
|
349
|
+
"Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
|
350
|
+
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela",
|
351
|
+
"Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara",
|
352
|
+
"Yemen", "Zambia", "Zimbabwe"
|
353
|
+
]
|
354
|
+
|
355
|
+
def self.find(country)
|
356
|
+
CURRENCIES[country]
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestBucks < Test::Unit::TestCase
|
4
|
+
def test_currency_for_every_country_in_the_list
|
5
|
+
Bucks::Currency::COUNTRIES.each do |country|
|
6
|
+
assert Bucks::Currency.find(country)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_currency_for_an_unexisting_country
|
11
|
+
assert_nil Bucks::Currency.find("Unicornland")
|
12
|
+
end
|
13
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
require 'bucks'
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bucks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- "Andr\xC3\xA9s Mej\xC3\xADa"
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-07 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: bundler
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
version: 1.0.0
|
32
|
+
type: :development
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: jeweler
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 5
|
45
|
+
- 1
|
46
|
+
version: 1.5.1
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rcov
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: *id003
|
63
|
+
description: Find the currency used in any country in the world
|
64
|
+
email: andmej@gmail.com
|
65
|
+
executables: []
|
66
|
+
|
67
|
+
extensions: []
|
68
|
+
|
69
|
+
extra_rdoc_files:
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.rdoc
|
72
|
+
files:
|
73
|
+
- .document
|
74
|
+
- Gemfile
|
75
|
+
- Gemfile.lock
|
76
|
+
- LICENSE.txt
|
77
|
+
- README.rdoc
|
78
|
+
- Rakefile
|
79
|
+
- VERSION
|
80
|
+
- lib/bucks.rb
|
81
|
+
- lib/bucks/currency.rb
|
82
|
+
- test/bucks/test_currency.rb
|
83
|
+
- test/helper.rb
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: http://github.com/andmej/bucks
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 483626547823970777
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 1.3.7
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Find the currency used in any country in the world
|
117
|
+
test_files:
|
118
|
+
- test/bucks/test_currency.rb
|
119
|
+
- test/helper.rb
|