iso_code 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -46,3 +46,12 @@ YARD::Rake::YardocTask.new
46
46
 
47
47
  task :test => :spec
48
48
  task :default => :spec
49
+
50
+ namespace :import do
51
+ desc 'Test countries import'
52
+ task :countries do
53
+ IsoCode::Iso3166.new(:de).read.each do |row|
54
+ puts row.inspect
55
+ end
56
+ end
57
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "iso_code"
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thomas Boerger"]
12
- s.date = "2011-10-12"
12
+ s.date = "2012-02-27"
13
13
  s.description = "Translate many available languages (ISO 639-3) and countries (ISO 3166) into requested languages"
14
14
  s.email = "tboerger@tbpro.de"
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,7 @@ module IsoCode
32
32
  # Parse all the PO files
33
33
  def parse_pofiles
34
34
  detectlocales.each do |locale, pofile|
35
- open(pofile) do |f|
35
+ open(pofile, 'r:utf-8') do |f|
36
36
  names = scan_names(f)
37
37
  i18ns = scan_i18ns(f)
38
38
 
@@ -28,12 +28,17 @@ module IsoCode
28
28
  protected
29
29
  # Parse the base XML file
30
30
  def parse_basexml
31
- Nokogiri::XML(open(@basexml)).search('//iso_3166_entries/iso_3166_entry').each do |row|
32
- en_name = row.attributes['name'].to_s
31
+ Nokogiri::XML(open(@basexml)).search('//iso_3166_entries/*').each do |row|
32
+ en_name = if row.has_attribute? 'names'
33
+ row.attributes['names'].to_s
34
+ else
35
+ row.attributes['name'].to_s
36
+ end
33
37
 
34
38
  @dataset[en_name] = {
35
39
  :alpha2 => row.attributes['alpha_2_code'].to_s || '',
36
40
  :alpha3 => row.attributes['alpha_3_code'].to_s || '',
41
+ :alpha4 => row.attributes['alpha_4_code'].to_s || '',
37
42
  :number => row.attributes['numeric_code'].to_s || '',
38
43
  :withdrawn => row.attributes['date_withdrawn'].to_s || '',
39
44
  :en => en_name
@@ -5,7 +5,7 @@ module IsoCode
5
5
  module Version
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 5
8
+ PATCH = 6
9
9
  BUILD = nil
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-12 00:00:00.000000000Z
12
+ date: 2012-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &70284131028360 !ruby/object:Gem::Requirement
16
+ requirement: &70277119696500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70284131028360
24
+ version_requirements: *70277119696500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70284131026940 !ruby/object:Gem::Requirement
27
+ requirement: &70277119711140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.3.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70284131026940
35
+ version_requirements: *70277119711140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &70284131026080 !ruby/object:Gem::Requirement
38
+ requirement: &70277119706420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.6.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70284131026080
46
+ version_requirements: *70277119706420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70284131024680 !ruby/object:Gem::Requirement
49
+ requirement: &70277119714780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70284131024680
57
+ version_requirements: *70277119714780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70284131023600 !ruby/object:Gem::Requirement
60
+ requirement: &70277119724980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70284131023600
68
+ version_requirements: *70277119724980
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70284131022380 !ruby/object:Gem::Requirement
71
+ requirement: &70277119735860 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70284131022380
79
+ version_requirements: *70277119735860
80
80
  description: Translate many available languages (ISO 639-3) and countries (ISO 3166)
81
81
  into requested languages
82
82
  email: tboerger@tbpro.de
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: 889434579029131303
120
+ hash: -1636655785082562488
121
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements: