bcardarella-decoder 0.5.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/decoder.gemspec +3 -6
- data/lib/countries/countries.rb +3 -3
- data/lib/countries/country.rb +2 -2
- data/lib/decoder.rb +1 -1
- data/lib/locales/en.yml +1083 -0
- data/test/common_methods_test.rb +6 -6
- data/test/countries/countries_test.rb +6 -5
- data/test/countries/country_test.rb +5 -5
- data/test/decoder_test.rb +4 -4
- data/test/states/state_test.rb +1 -1
- metadata +5 -7
- data/lib/i18n/countries/eng.yml +0 -252
- data/lib/i18n/states/au/eng.yml +0 -9
- data/lib/i18n/states/ca/eng.yml +0 -14
- data/lib/i18n/states/us/eng.yml +0 -60
data/test/common_methods_test.rb
CHANGED
@@ -2,23 +2,23 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class CommonMethodsTest < Test::Unit::TestCase
|
4
4
|
|
5
|
-
class
|
5
|
+
class EmptyClass
|
6
6
|
include CommonMethods
|
7
7
|
attr_accessor :code, :name
|
8
8
|
end
|
9
9
|
|
10
10
|
context "CommonMethods" do
|
11
11
|
setup do
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
12
|
+
@empty_class = EmptyClass.new
|
13
|
+
@empty_class.code = "TS"
|
14
|
+
@empty_class.name = "TEST"
|
15
15
|
end
|
16
16
|
should "print #name for #to_s" do
|
17
|
-
assert_equal @
|
17
|
+
assert_equal @empty_class.name, @empty_class.to_s
|
18
18
|
end
|
19
19
|
|
20
20
|
should "print '#<#class code: code, #name: #name>" do
|
21
|
-
assert_equal "#<CommonMethodsTest::
|
21
|
+
assert_equal "#<CommonMethodsTest::EmptyClass code: TS, name: TEST>", @empty_class.inspect
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
class CountriesTest < Test::Unit::TestCase
|
4
4
|
context "English" do
|
5
5
|
setup do
|
6
|
-
Decoder.i18n = :
|
6
|
+
Decoder.i18n = :en
|
7
7
|
end
|
8
8
|
|
9
9
|
context "Loading the YAML" do
|
@@ -11,14 +11,15 @@ class CountriesTest < Test::Unit::TestCase
|
|
11
11
|
@countries = Decoder::Countries.new
|
12
12
|
end
|
13
13
|
|
14
|
-
should "load
|
15
|
-
assert_match /
|
14
|
+
should "load locales/en.yml" do
|
15
|
+
assert_match /en.yml/, @countries.yaml_file_name
|
16
16
|
end
|
17
17
|
|
18
18
|
should "set the #countries with the country data" do
|
19
|
-
YAML.expects(:load_file).returns({:US => "United States"
|
19
|
+
YAML.expects(:load_file).returns({:en => {"US" => {:name => "United States",
|
20
|
+
:states => {}}}})
|
20
21
|
@countries.load_yaml
|
21
|
-
assert "United States", @countries.countries[
|
22
|
+
assert "United States", @countries.countries["US"][:name]
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -8,7 +8,7 @@ class CountryTest < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
context "English" do
|
10
10
|
setup do
|
11
|
-
Decoder.i18n = :
|
11
|
+
Decoder.i18n = :en
|
12
12
|
end
|
13
13
|
|
14
14
|
context "Loading the YAML" do
|
@@ -16,13 +16,13 @@ class CountryTest < Test::Unit::TestCase
|
|
16
16
|
@country = Decoder::Country.new(:code => "US", :name => "United States")
|
17
17
|
end
|
18
18
|
|
19
|
-
should "load yaml/states/us/
|
20
|
-
assert_match /
|
21
|
-
assert_match /us/, @country.yaml_file_name
|
19
|
+
should "load yaml/states/us/en.yml" do
|
20
|
+
assert_match /en.yml/, @country.yaml_file_name
|
22
21
|
end
|
23
22
|
|
24
23
|
should "set the #states with the US state data" do
|
25
|
-
YAML.expects(:load_file).returns({:
|
24
|
+
YAML.expects(:load_file).returns({:en => {"US" => {:name => "United States",
|
25
|
+
:states => {"MA" => "Massachusetts"}}}})
|
26
26
|
@country.load_yaml
|
27
27
|
assert "Massachusetts", @country.states[:MA]
|
28
28
|
end
|
data/test/decoder_test.rb
CHANGED
@@ -3,12 +3,12 @@ require 'test_helper'
|
|
3
3
|
class DecoderTest < Test::Unit::TestCase
|
4
4
|
context "i18n" do
|
5
5
|
should "default to :eng" do
|
6
|
-
assert_equal :
|
6
|
+
assert_equal :en, Decoder.i18n
|
7
7
|
end
|
8
8
|
|
9
|
-
should "set the Internationalization code to :
|
10
|
-
Decoder.i18n = :
|
11
|
-
assert_equal :
|
9
|
+
should "set the Internationalization code to :de (German)" do
|
10
|
+
Decoder.i18n = :de
|
11
|
+
assert_equal :de, Decoder.i18n
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/test/states/state_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcardarella-decoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Cardarella
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,10 +43,7 @@ files:
|
|
43
43
|
- lib/countries/countries.rb
|
44
44
|
- lib/countries/country.rb
|
45
45
|
- lib/decoder.rb
|
46
|
-
- lib/
|
47
|
-
- lib/i18n/states/au/eng.yml
|
48
|
-
- lib/i18n/states/ca/eng.yml
|
49
|
-
- lib/i18n/states/us/eng.yml
|
46
|
+
- lib/locales/en.yml
|
50
47
|
- lib/states/state.rb
|
51
48
|
- test/common_methods_test.rb
|
52
49
|
- test/countries/countries_test.rb
|
@@ -56,6 +53,7 @@ files:
|
|
56
53
|
- test/test_helper.rb
|
57
54
|
has_rdoc: true
|
58
55
|
homepage: http://github.com/bcardarelladecoder
|
56
|
+
licenses:
|
59
57
|
post_install_message:
|
60
58
|
rdoc_options:
|
61
59
|
- --charset=UTF-8
|
@@ -76,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
74
|
requirements: []
|
77
75
|
|
78
76
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.3.5
|
80
78
|
signing_key:
|
81
79
|
specification_version: 3
|
82
80
|
summary: Decoder
|
data/lib/i18n/countries/eng.yml
DELETED
@@ -1,252 +0,0 @@
|
|
1
|
-
---
|
2
|
-
UY: Uruguay
|
3
|
-
NP: Nepal
|
4
|
-
BS: Bahamas
|
5
|
-
HT: Haiti
|
6
|
-
LK: Sri Lanka
|
7
|
-
SE: Sweden
|
8
|
-
DZ: Algeria
|
9
|
-
TW: Taiwan
|
10
|
-
GU: Guam
|
11
|
-
NC: New Caledonia
|
12
|
-
BH: Bahrain
|
13
|
-
RS: Serbia
|
14
|
-
CY: Cyprus
|
15
|
-
KW: Kuwait
|
16
|
-
MU: Mauritius
|
17
|
-
AZ: Azerbaijan
|
18
|
-
TM: Turkmenistan
|
19
|
-
GM: Gambia
|
20
|
-
ZR: Zaire
|
21
|
-
KG: Kyrgyzstan
|
22
|
-
PS: Palestinian Territory, Occupied
|
23
|
-
CN: China
|
24
|
-
TC: Turks and Caicos Islands
|
25
|
-
GB: Great Britain (UK)
|
26
|
-
MN: Mongolia
|
27
|
-
AQ: Antarctica
|
28
|
-
WF: Wallis and Futuna Islands
|
29
|
-
PG: Papua New Guinea
|
30
|
-
CF: Central African Republic
|
31
|
-
IS: Iceland
|
32
|
-
MD: Moldova
|
33
|
-
AF: Afghanistan
|
34
|
-
SO: Somalia
|
35
|
-
FJ: Fiji
|
36
|
-
VA: Vatican City State (Holy See)
|
37
|
-
ID: Indonesia
|
38
|
-
NT: Neutral Zone
|
39
|
-
BV: Bouvet Island
|
40
|
-
SH: St. Helena
|
41
|
-
EE: Estonia
|
42
|
-
LS: Lesotho
|
43
|
-
UA: Ukraine
|
44
|
-
NF: Norfolk Island
|
45
|
-
BJ: Benin
|
46
|
-
GY: Guyana
|
47
|
-
KZ: Kazakhstan
|
48
|
-
RW: Rwanda
|
49
|
-
DE: Germany
|
50
|
-
GP: Guadeloupe
|
51
|
-
MW: Malawi
|
52
|
-
BB: Barbados
|
53
|
-
TO: Tonga
|
54
|
-
CR: Costa Rica
|
55
|
-
KI: Kiribati
|
56
|
-
PW: Palau
|
57
|
-
AS: American Samoa
|
58
|
-
TF: French Southern Territories
|
59
|
-
GE: Georgia
|
60
|
-
IO: British Indian Ocean Territory
|
61
|
-
MP: Northern Mariana Islands
|
62
|
-
YE: Yemen
|
63
|
-
PK: Pakistan
|
64
|
-
CH: Switzerland
|
65
|
-
JE: Jersey
|
66
|
-
MG: Madagascar
|
67
|
-
AI: Anguilla
|
68
|
-
ST: Sao Tome and Principe
|
69
|
-
FM: Micronesia
|
70
|
-
VE: Venezuela
|
71
|
-
IL: Israel
|
72
|
-
NZ: New Zealand (Aotearoa)
|
73
|
-
BY: Belarus
|
74
|
-
SJ: Svalbard & Jan Mayen Islands
|
75
|
-
EH: Western Sahara
|
76
|
-
LU: Luxembourg
|
77
|
-
UK: United Kingdom
|
78
|
-
NI: Nicaragua
|
79
|
-
BN: Brunei Darussalam
|
80
|
-
HM: Heard and McDonald Islands
|
81
|
-
LB: Lebanon
|
82
|
-
SB: Solomon Islands
|
83
|
-
DK: Denmark
|
84
|
-
TR: Turkey
|
85
|
-
GR: Greece
|
86
|
-
MY: Malaysia
|
87
|
-
BE: Belgium
|
88
|
-
QA: Qatar
|
89
|
-
CU: Cuba
|
90
|
-
KN: Saint Kitts and Nevis
|
91
|
-
MR: Mauritania
|
92
|
-
AU: Australia
|
93
|
-
TH: Thailand
|
94
|
-
GH: Ghana
|
95
|
-
YU: Yugoslavia (former)
|
96
|
-
JO: Jordan
|
97
|
-
PM: St. Pierre and Miquelon
|
98
|
-
CK: Cook Islands
|
99
|
-
SV: El Salvador
|
100
|
-
FR: France
|
101
|
-
MK: F.Y.R.O.M. (Macedonia)
|
102
|
-
AM: Armenia
|
103
|
-
VI: Virgin Islands (U.S.)
|
104
|
-
PA: Panama
|
105
|
-
CA: Canada
|
106
|
-
IN: India
|
107
|
-
LY: Libya
|
108
|
-
AC: Ascension Island
|
109
|
-
SL: Sierra Leone
|
110
|
-
ES: Spain
|
111
|
-
US: United States
|
112
|
-
HR: Croatia (Hrvatska)
|
113
|
-
NO: Norway
|
114
|
-
BR: Brazil
|
115
|
-
SD: Sudan
|
116
|
-
DO: Dominican Republic
|
117
|
-
LI: Liechtenstein
|
118
|
-
TV: Tuvalu
|
119
|
-
NA: Namibia
|
120
|
-
BG: Bulgaria
|
121
|
-
GT: Guatemala
|
122
|
-
KR: Korea (South)
|
123
|
-
RO: Romania
|
124
|
-
CX: Christmas Island
|
125
|
-
TK: Tokelau
|
126
|
-
GL: Greenland
|
127
|
-
MT: Malta
|
128
|
-
AX: Aland Islands
|
129
|
-
ZM: Zambia
|
130
|
-
PR: Puerto Rico
|
131
|
-
CM: Cameroon
|
132
|
-
KE: Kenya
|
133
|
-
MM: Myanmar
|
134
|
-
AO: Angola
|
135
|
-
SZ: Swaziland
|
136
|
-
GA: Gabon
|
137
|
-
VU: Vanuatu
|
138
|
-
IR: Iran
|
139
|
-
PF: French Polynesia
|
140
|
-
CD: Congo, Democratic Republic
|
141
|
-
FI: Finland
|
142
|
-
MC: Monaco
|
143
|
-
AE: United Arab Emirates
|
144
|
-
SN: Senegal
|
145
|
-
UZ: Uzbekistan
|
146
|
-
BT: Bhutan
|
147
|
-
HU: Hungary
|
148
|
-
NR: Nauru
|
149
|
-
SG: Singapore
|
150
|
-
EC: Ecuador
|
151
|
-
LR: Liberia
|
152
|
-
TZ: Tanzania
|
153
|
-
NE: Niger
|
154
|
-
BI: Burundi
|
155
|
-
GW: Guinea-Bissau
|
156
|
-
KY: Cayman Islands
|
157
|
-
RU: Russian Federation
|
158
|
-
CZ: Czech Republic
|
159
|
-
TN: Tunisia
|
160
|
-
GN: Guinea
|
161
|
-
MV: Maldives
|
162
|
-
BA: Bosnia and Herzegovina
|
163
|
-
ZW: Zimbabwe
|
164
|
-
PT: Portugal
|
165
|
-
CO: Colombia
|
166
|
-
KH: Cambodia
|
167
|
-
MO: Macau
|
168
|
-
AR: Argentina
|
169
|
-
TD: Chad
|
170
|
-
GD: Grenada
|
171
|
-
WS: Samoa
|
172
|
-
IT: Italy
|
173
|
-
PH: Philippines
|
174
|
-
CG: Congo
|
175
|
-
SR: Suriname
|
176
|
-
FK: Falkland Islands (Malvinas)
|
177
|
-
ME: Montenegro
|
178
|
-
AG: Antigua and Barbuda
|
179
|
-
VC: Saint Vincent & the Grenadines
|
180
|
-
NU: Niue
|
181
|
-
BW: Botswana
|
182
|
-
IE: Ireland
|
183
|
-
LT: Lithuania
|
184
|
-
SI: Slovenia
|
185
|
-
EG: Egypt
|
186
|
-
UG: Uganda
|
187
|
-
HK: Hong Kong
|
188
|
-
NG: Nigeria
|
189
|
-
BM: Bermuda
|
190
|
-
SA: Saudi Arabia
|
191
|
-
DJ: Djibouti
|
192
|
-
LA: Laos
|
193
|
-
TP: East Timor
|
194
|
-
MX: Mexico
|
195
|
-
BD: Bangladesh
|
196
|
-
GQ: Equatorial Guinea
|
197
|
-
KM: Comoros
|
198
|
-
PY: Paraguay
|
199
|
-
CS: Czechoslovakia (former)
|
200
|
-
TG: Togo
|
201
|
-
GF: French Guiana
|
202
|
-
MQ: Martinique
|
203
|
-
AT: Austria
|
204
|
-
YT: Mayotte
|
205
|
-
PL: Poland
|
206
|
-
CI: Cote D'Ivoire (Ivory Coast)
|
207
|
-
JM: Jamaica
|
208
|
-
MH: Marshall Islands
|
209
|
-
AL: Albania
|
210
|
-
SU: USSR (former)
|
211
|
-
FO: Faroe Islands
|
212
|
-
VG: British Virgin Islands
|
213
|
-
IM: Isle of Man
|
214
|
-
OM: Oman
|
215
|
-
BZ: Belize
|
216
|
-
SK: Slovak Republic
|
217
|
-
ER: Eritrea
|
218
|
-
LV: Latvia
|
219
|
-
UM: US Minor Outlying Islands
|
220
|
-
NL: Netherlands
|
221
|
-
BO: Bolivia
|
222
|
-
HN: Honduras
|
223
|
-
LC: Saint Lucia
|
224
|
-
SC: Seychelles
|
225
|
-
DM: Dominica
|
226
|
-
TT: Trinidad and Tobago
|
227
|
-
GS: S. Georgia and S. Sandwich Isls.
|
228
|
-
MZ: Mozambique
|
229
|
-
BF: Burkina Faso
|
230
|
-
CV: Cape Verde
|
231
|
-
KP: Korea (North)
|
232
|
-
RE: Reunion
|
233
|
-
AW: Aruba
|
234
|
-
TJ: Tajikistan
|
235
|
-
GI: Gibraltar
|
236
|
-
MS: Montserrat
|
237
|
-
ZA: South Africa
|
238
|
-
PN: Pitcairn
|
239
|
-
CL: Chile
|
240
|
-
JP: Japan
|
241
|
-
ML: Mali
|
242
|
-
AN: Netherlands Antilles
|
243
|
-
SY: Syria
|
244
|
-
FX: France, Metropolitan
|
245
|
-
VN: Viet Nam
|
246
|
-
IQ: Iraq
|
247
|
-
PE: Peru
|
248
|
-
CC: Cocos (Keeling) Islands
|
249
|
-
SM: San Marino
|
250
|
-
ET: Ethiopia
|
251
|
-
MA: Morocco
|
252
|
-
AD: Andorra
|
data/lib/i18n/states/au/eng.yml
DELETED
data/lib/i18n/states/ca/eng.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
---
|
2
|
-
ON: Ontario
|
3
|
-
NB: New Brunswick
|
4
|
-
PE: Prince Edward Island
|
5
|
-
NL: Newfoundland and Labrador
|
6
|
-
QC: Quebec
|
7
|
-
NT: Northwest Territories
|
8
|
-
SK: Saskatchewan
|
9
|
-
AB: Alberta
|
10
|
-
NS: Nova Scotia
|
11
|
-
YT: Yukon
|
12
|
-
BC: British Columbia
|
13
|
-
NU: Nunavut
|
14
|
-
MB: Manitoba
|
data/lib/i18n/states/us/eng.yml
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
---
|
2
|
-
HI: Hawaii
|
3
|
-
KY: Kentucky
|
4
|
-
MN: Minnesota
|
5
|
-
OK: Oklahoma
|
6
|
-
FM: Federated States Of Micronesia
|
7
|
-
MT: Montana
|
8
|
-
NJ: New Jersey
|
9
|
-
PW: Palau
|
10
|
-
SD: South Dakota
|
11
|
-
VI: Virgin Islands
|
12
|
-
WA: Washington
|
13
|
-
DE: Delaware
|
14
|
-
IA: Iowa
|
15
|
-
MO: Missouri
|
16
|
-
OR: Oregon
|
17
|
-
AK: Alaska
|
18
|
-
MH: Marshall Islands
|
19
|
-
NM: New Mexico
|
20
|
-
WV: West Virginia
|
21
|
-
ID: Idaho
|
22
|
-
IL: Illinois
|
23
|
-
KS: Kansas
|
24
|
-
LA: Louisiana
|
25
|
-
MA: Massachusetts
|
26
|
-
MP: Northern Mariana Islands
|
27
|
-
RI: Rhode Island
|
28
|
-
VA: Virginia
|
29
|
-
CT: Connecticut
|
30
|
-
NY: New York
|
31
|
-
WI: Wisconsin
|
32
|
-
GU: Guam
|
33
|
-
MI: Michigan
|
34
|
-
NC: North Carolina
|
35
|
-
PR: Puerto Rico
|
36
|
-
TX: Texas
|
37
|
-
DC: District Of Columbia
|
38
|
-
ND: North Dakota
|
39
|
-
TN: T:Tnessee
|
40
|
-
WY: Wyoming
|
41
|
-
AR: Arkansas
|
42
|
-
IN: Indiana
|
43
|
-
MD: Maryland
|
44
|
-
NE: Nebraska
|
45
|
-
NV: Nevada
|
46
|
-
UT: Utah
|
47
|
-
AL: Alabama
|
48
|
-
AZ: Arizona
|
49
|
-
FL: Florida
|
50
|
-
GA: Georgia
|
51
|
-
OH: Ohio
|
52
|
-
AS: American Samoa
|
53
|
-
CA: California
|
54
|
-
CO: Colorado
|
55
|
-
ME: Maine
|
56
|
-
MS: Mississippi
|
57
|
-
NH: New Hampshire
|
58
|
-
PA: Pennsylvania
|
59
|
-
SC: South Carolina
|
60
|
-
VT: Vermont
|