bcardarella-decoder 0.5.1 → 0.6.1
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/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/README.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
= Usage
|
4
4
|
|
5
|
-
>> Decoder.i18n = :
|
5
|
+
>> Decoder.i18n = :en
|
6
6
|
>> country = Decoder::Countries[:US]
|
7
7
|
>> country.to_s
|
8
8
|
=> "United States"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
Currently the yaml files are still quite incomplete. Please fork and populate!
|
14
14
|
|
15
15
|
= i18n
|
16
|
-
When adding a new language please use the ISO 639-
|
16
|
+
When adding a new language please use the ISO 639-1 Code 2-letter standard.
|
17
17
|
You can find the appropriate code for a given language here:
|
18
18
|
http://www.loc.gov/standards/iso639-2/php/code_list.php
|
19
19
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.1
|
data/decoder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{decoder}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Cardarella"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-04}
|
13
13
|
s.description = %q{Decoder}
|
14
14
|
s.email = %q{bcardarella@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,10 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/countries/countries.rb",
|
29
29
|
"lib/countries/country.rb",
|
30
30
|
"lib/decoder.rb",
|
31
|
-
"lib/
|
32
|
-
"lib/i18n/states/au/eng.yml",
|
33
|
-
"lib/i18n/states/ca/eng.yml",
|
34
|
-
"lib/i18n/states/us/eng.yml",
|
31
|
+
"lib/locales/en.yml",
|
35
32
|
"lib/states/state.rb",
|
36
33
|
"test/common_methods_test.rb",
|
37
34
|
"test/countries/countries_test.rb",
|
data/lib/countries/countries.rb
CHANGED
@@ -7,17 +7,17 @@ module Decoder
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def load_yaml
|
10
|
-
self.countries = YAML.load_file(yaml_file_name)
|
10
|
+
self.countries = YAML.load_file(yaml_file_name)[Decoder.i18n]
|
11
11
|
end
|
12
12
|
|
13
13
|
def yaml_file_name
|
14
|
-
"#{File.dirname(__FILE__)}/../
|
14
|
+
"#{File.dirname(__FILE__)}/../locales/#{Decoder.i18n}.yml"
|
15
15
|
end
|
16
16
|
|
17
17
|
def [](_code)
|
18
18
|
_code = _code.to_s.upcase
|
19
19
|
country = countries[_code]
|
20
|
-
Decoder::Country.new(:code => _code, :name => country)
|
20
|
+
Decoder::Country.new(:code => _code, :name => country[:name])
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.[](_code)
|
data/lib/countries/country.rb
CHANGED
@@ -13,11 +13,11 @@ module Decoder
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def load_yaml
|
16
|
-
self.states = YAML.load_file(yaml_file_name)
|
16
|
+
self.states = YAML.load_file(yaml_file_name)[Decoder.i18n][self.code][:states]
|
17
17
|
end
|
18
18
|
|
19
19
|
def yaml_file_name
|
20
|
-
"#{File.dirname(__FILE__)}/../
|
20
|
+
"#{File.dirname(__FILE__)}/../locales/#{Decoder.i18n}.yml"
|
21
21
|
end
|
22
22
|
|
23
23
|
def [](_code)
|