countries 2.0.5 β†’ 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -3
  3. data/README.markdown +1 -1
  4. data/countries.gemspec +1 -0
  5. data/lib/countries/cache/countries.json +1 -1
  6. data/lib/countries/data.rb +9 -5
  7. data/lib/countries/data/countries/AX.yaml +1 -1
  8. data/lib/countries/data/countries/BL.yaml +1 -1
  9. data/lib/countries/data/countries/BO.yaml +1 -1
  10. data/lib/countries/data/countries/BV.yaml +1 -1
  11. data/lib/countries/data/countries/CD.yaml +1 -1
  12. data/lib/countries/data/countries/CI.yaml +1 -1
  13. data/lib/countries/data/countries/CV.yaml +1 -1
  14. data/lib/countries/data/countries/CZ.yaml +1 -1
  15. data/lib/countries/data/countries/FM.yaml +1 -1
  16. data/lib/countries/data/countries/GB.yaml +1 -1
  17. data/lib/countries/data/countries/GF.yaml +1 -0
  18. data/lib/countries/data/countries/GG.yaml +1 -1
  19. data/lib/countries/data/countries/HM.yaml +1 -1
  20. data/lib/countries/data/countries/IM.yaml +1 -1
  21. data/lib/countries/data/countries/IR.yaml +1 -1
  22. data/lib/countries/data/countries/JE.yaml +1 -1
  23. data/lib/countries/data/countries/KN.yaml +1 -1
  24. data/lib/countries/data/countries/KP.yaml +1 -1
  25. data/lib/countries/data/countries/KR.yaml +1 -1
  26. data/lib/countries/data/countries/MD.yaml +1 -1
  27. data/lib/countries/data/countries/MF.yaml +2 -2
  28. data/lib/countries/data/countries/MK.yaml +1 -1
  29. data/lib/countries/data/countries/NO.yaml +1 -1
  30. data/lib/countries/data/countries/PM.yaml +1 -1
  31. data/lib/countries/data/countries/PS.yaml +1 -1
  32. data/lib/countries/data/countries/SH.yaml +1 -1
  33. data/lib/countries/data/countries/SJ.yaml +1 -1
  34. data/lib/countries/data/countries/SS.yaml +1 -0
  35. data/lib/countries/data/countries/SX.yaml +1 -1
  36. data/lib/countries/data/countries/TF.yaml +1 -1
  37. data/lib/countries/data/countries/TL.yaml +1 -1
  38. data/lib/countries/data/countries/TW.yaml +1 -1
  39. data/lib/countries/data/countries/VA.yaml +1 -1
  40. data/lib/countries/data/countries/VC.yaml +1 -1
  41. data/lib/countries/data/countries/VE.yaml +1 -1
  42. data/lib/countries/data/countries/VG.yaml +1 -1
  43. data/lib/countries/data/countries/VI.yaml +1 -1
  44. data/lib/countries/data/countries/VN.yaml +1 -1
  45. data/lib/countries/version.rb +1 -1
  46. data/spec/country_spec.rb +11 -2
  47. data/spec/global_spec.rb +1 -1
  48. data/spec/perf_spec.rb +23 -4
  49. metadata +17 -3
@@ -7,7 +7,7 @@ VE:
7
7
  international_prefix: '00'
8
8
  ioc: VEN
9
9
  gec: VE
10
- name: Venezuela, Bolivarian Republic of
10
+ name: Venezuela (Bolivarian Republic of)
11
11
  national_destination_code_lengths:
12
12
  - 2
13
13
  national_number_lengths:
@@ -8,7 +8,7 @@ VG:
8
8
  international_prefix: '011'
9
9
  ioc: IVB
10
10
  gec: VI
11
- name: Virgin Islands, British
11
+ name: Virgin Islands (British)
12
12
  national_destination_code_lengths:
13
13
  - 3
14
14
  national_number_lengths:
@@ -7,7 +7,7 @@ VI:
7
7
  international_prefix: '011'
8
8
  ioc: ISV
9
9
  gec: VQ
10
- name: Virgin Islands, U.S.
10
+ name: Virgin Islands (U.S.)
11
11
  national_destination_code_lengths:
12
12
  - 3
13
13
  national_number_lengths:
@@ -7,7 +7,7 @@ VN:
7
7
  international_prefix: '00'
8
8
  ioc: VIE
9
9
  gec: VM
10
- name: Vietnam
10
+ name: Viet Nam
11
11
  national_destination_code_lengths:
12
12
  - 2
13
13
  national_number_lengths:
@@ -1,3 +1,3 @@
1
1
  module Countries
2
- VERSION = '2.0.5'.freeze
2
+ VERSION = '2.0.6'.freeze
3
3
  end
data/spec/country_spec.rb CHANGED
@@ -734,7 +734,7 @@ describe ISO3166::Country do
734
734
 
735
735
  describe 'to_s' do
736
736
  it 'should return the country name' do
737
- expect(ISO3166::Country.new('GB').to_s).to eq('United Kingdom')
737
+ expect(ISO3166::Country.new('GB').to_s).to eq('United Kingdom of Great Britain and Northern Ireland')
738
738
  end
739
739
  end
740
740
 
@@ -768,7 +768,7 @@ describe ISO3166::Country do
768
768
  it 'should return country if not convertable input given' do
769
769
  expect do
770
770
  ISO3166::Country(42)
771
- end.to raise_error(TypeError, "can't convert Fixnum into ISO3166::Country")
771
+ end.to raise_error(TypeError, /can't convert ([A-z]+) into ISO3166::Country/)
772
772
  end
773
773
  end
774
774
 
@@ -806,4 +806,13 @@ describe ISO3166::Country do
806
806
  expect(country.emoji_flag).to eq 'πŸ‡ΊπŸ‡Έ'
807
807
  end
808
808
  end
809
+
810
+ describe '#un_locode' do
811
+ let(:countries) { ISO3166::Country.all }
812
+
813
+ it 'should have two letter un_locode for each country' do
814
+ expect(countries.all? { |country| !country.un_locode.nil? }).to be
815
+ expect(countries.all? { |country| country.un_locode.length == 2 }).to be
816
+ end
817
+ end
809
818
  end
data/spec/global_spec.rb CHANGED
@@ -22,7 +22,7 @@ describe 'global Country class', order: :defined do
22
22
 
23
23
  describe 'to_s' do
24
24
  it 'should return the country name' do
25
- expect(Country.new('GB').to_s).to eq('United Kingdom')
25
+ expect(Country.new('GB').to_s).to eq('United Kingdom of Great Britain and Northern Ireland')
26
26
  end
27
27
  end
28
28
  end
data/spec/perf_spec.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe ISO3166::Data, perf: true, order: :defined do
5
+
5
6
  ALL_LOCALES = [
6
7
  :af, :am, :ar, :as, :az, :be, :bg, :bn, :br, :bs, :ca, :cs, :cy, :da, :de,
7
8
  :dz, :el, :en, :eo, :es, :et, :eu, :fa, :fi, :fo, :fr, :ga, :gl, :gu, :he,
@@ -12,7 +13,7 @@ describe ISO3166::Data, perf: true, order: :defined do
12
13
  :zh, :zu
13
14
  ].freeze
14
15
 
15
- it 'responds to call' do
16
+ def perf_report(name)
16
17
  require 'benchmark'
17
18
  require 'memory_profiler'
18
19
  require 'ruby-prof'
@@ -20,9 +21,7 @@ describe ISO3166::Data, perf: true, order: :defined do
20
21
  RubyProf.start
21
22
 
22
23
  100.times do
23
- ISO3166.reset
24
- data = ISO3166::Data.new('US').call
25
- expect(data['translated_names']).to be_a Array
24
+ yield if block_given?
26
25
  end
27
26
 
28
27
  result = RubyProf.stop
@@ -32,6 +31,14 @@ describe ISO3166::Data, perf: true, order: :defined do
32
31
  printer.print(STDOUT)
33
32
  end
34
33
 
34
+ it 'responds to call' do
35
+ perf_report('translations') do
36
+ ISO3166.reset
37
+ data = ISO3166::Data.new('US').call
38
+ expect(data['translated_names']).to be_a Array
39
+ end
40
+ end
41
+
35
42
  it 'locales will load prior to return results' do
36
43
  ISO3166.configuration.locales = [:es, :de, :en]
37
44
  report = MemoryProfiler.report do
@@ -52,4 +59,16 @@ describe ISO3166::Data, perf: true, order: :defined do
52
59
 
53
60
  report.pretty_print(to_file: 'tmp/memory/all_locales')
54
61
  end
62
+
63
+ it 'loades a specfic country quickly' do
64
+ codes = Dir['lib/countries/data/countries/*.yaml'].map { |x| File.basename(x, File.extname(x)) }.uniq
65
+ Benchmark.bmbm do |bm|
66
+ bm.report('find_by_alpha2') do
67
+ codes.map { |cc| ISO3166::Country.find_country_by_alpha2 cc }
68
+ end
69
+ bm.report('new') do
70
+ codes.map { |cc| ISO3166::Country.new cc }
71
+ end
72
+ end
73
+ end
55
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: countries
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Robinson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-12-09 00:00:00.000000000 Z
13
+ date: 2017-01-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n_data
@@ -54,6 +54,20 @@ dependencies:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '1.4'
57
+ - !ruby/object:Gem::Dependency
58
+ name: sixarm_ruby_unaccent
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '1.1'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '1.1'
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: rspec
59
73
  requirement: !ruby/object:Gem::Requirement
@@ -690,7 +704,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
690
704
  version: '0'
691
705
  requirements: []
692
706
  rubyforge_project:
693
- rubygems_version: 2.5.1
707
+ rubygems_version: 2.5.2
694
708
  signing_key:
695
709
  specification_version: 4
696
710
  summary: Gives you a country object full of all sorts of useful information.