country_select 3.1.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/build.yml +25 -0
  3. data/.github/workflows/codeql-analysis.yml +70 -0
  4. data/CHANGELOG.md +44 -0
  5. data/Gemfile +0 -6
  6. data/Gemfile.lock +72 -275
  7. data/README.md +44 -8
  8. data/Rakefile +3 -3
  9. data/country_select.gemspec +10 -9
  10. data/gemfiles/actionpack-5.2.gemfile +6 -0
  11. data/gemfiles/actionpack-5.2.gemfile.lock +106 -0
  12. data/gemfiles/actionpack-6.0.gemfile +6 -0
  13. data/gemfiles/actionpack-6.0.gemfile.lock +107 -0
  14. data/gemfiles/actionpack-6.1.gemfile +6 -0
  15. data/gemfiles/actionpack-6.1.gemfile.lock +107 -0
  16. data/gemfiles/actionpack-7.0.gemfile +6 -0
  17. data/gemfiles/actionpack-7.0.gemfile.lock +107 -0
  18. data/gemfiles/{actionpack.edge.gemfile → actionpack-head.gemfile} +0 -6
  19. data/gemfiles/actionpack-head.gemfile.lock +104 -0
  20. data/lib/country_select/defaults.rb +10 -0
  21. data/lib/country_select/formats.rb +3 -1
  22. data/lib/country_select/tag_helper.rb +20 -10
  23. data/lib/country_select/version.rb +1 -1
  24. data/lib/country_select.rb +2 -6
  25. data/lib/country_select_without_sort_alphabetical.rb +2 -6
  26. data/spec/country_select_spec.rb +47 -7
  27. metadata +37 -52
  28. data/.travis.yml +0 -35
  29. data/gemfiles/actionpack.edge.gemfile.lock +0 -313
  30. data/gemfiles/actionpack3.2.gemfile +0 -11
  31. data/gemfiles/actionpack3.2.gemfile.lock +0 -300
  32. data/gemfiles/actionpack4.0.gemfile +0 -11
  33. data/gemfiles/actionpack4.0.gemfile.lock +0 -289
  34. data/gemfiles/actionpack4.1.gemfile +0 -11
  35. data/gemfiles/actionpack4.1.gemfile.lock +0 -293
  36. data/gemfiles/actionpack4.2.gemfile +0 -14
  37. data/gemfiles/actionpack4.2.gemfile.lock +0 -309
  38. data/gemfiles/actionpack5.0.gemfile +0 -12
  39. data/gemfiles/actionpack5.0.gemfile.lock +0 -314
  40. data/gemfiles/actionpack5.1.gemfile +0 -12
  41. data/gemfiles/actionpack5.1.gemfile.lock +0 -314
  42. data/lib/country_select/rails3/country_select_helper.rb +0 -39
@@ -8,25 +8,26 @@ Gem::Specification.new do |s|
8
8
  s.licenses = ['MIT']
9
9
  s.authors = ['Stefan Penner']
10
10
  s.email = ['stefan.penner@gmail.com']
11
- s.homepage = 'https://github.com/stefanpenner/country_select'
11
+ s.homepage = 'https://github.com/countries/country_select'
12
12
  s.summary = %q{Country Select Plugin}
13
- s.description = %q{Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it will still offend some users.}
13
+ s.description = %q{Provides a simple helper to get an HTML select list of countries. The list of countries comes from the ISO 3166 standard. While it is a relatively neutral source of country names, it will still offend some users.}
14
14
 
15
- s.rubyforge_project = 'country_select'
15
+ s.metadata = { 'bug_tracker_uri' => 'http://github.com/countries/country_select/issues',
16
+ 'changelog_uri' => 'https://github.com/countries/country_select/blob/master/CHANGELOG.md',
17
+ 'source_code_uri' => 'https://github.com/countries/country_select' }
16
18
 
17
19
  s.files = `git ls-files`.split("\n")
18
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
22
  s.require_paths = ['lib']
21
23
 
22
- s.required_ruby_version = '>= 2'
24
+ s.required_ruby_version = '>= 2.7'
23
25
 
24
- s.add_development_dependency 'actionpack', '~> 3'
26
+ s.add_development_dependency 'actionpack', '~> 7.0'
25
27
  s.add_development_dependency 'pry', '~> 0'
26
- s.add_development_dependency 'rake'
28
+ s.add_development_dependency 'rake', '~> 13'
27
29
  s.add_development_dependency 'rspec', '~> 3'
28
- s.add_development_dependency 'wwtd'
29
30
 
30
- s.add_dependency 'countries', '~> 2.0'
31
- s.add_dependency 'sort_alphabetical', '~> 1.0'
31
+ s.add_dependency 'countries', '~> 5.0'
32
+ s.add_dependency 'sort_alphabetical', '~> 1.1'
32
33
  end
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => "../"
4
+
5
+ gem "railties", "~> 5.2"
6
+ gem "actionpack", "~> 5.2"
@@ -0,0 +1,106 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ country_select (7.0.0)
5
+ countries (~> 5.0)
6
+ sort_alphabetical (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (5.2.7)
12
+ actionview (= 5.2.7)
13
+ activesupport (= 5.2.7)
14
+ rack (~> 2.0, >= 2.0.8)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (5.2.7)
19
+ activesupport (= 5.2.7)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
+ activesupport (5.2.7)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 0.7, < 2)
27
+ minitest (~> 5.1)
28
+ tzinfo (~> 1.1)
29
+ builder (3.2.4)
30
+ coderay (1.1.3)
31
+ concurrent-ruby (1.1.10)
32
+ countries (5.0.0)
33
+ i18n_data (~> 0.16.0)
34
+ sixarm_ruby_unaccent (~> 1.1)
35
+ crass (1.0.6)
36
+ diff-lcs (1.5.0)
37
+ erubi (1.10.0)
38
+ i18n (1.10.0)
39
+ concurrent-ruby (~> 1.0)
40
+ i18n_data (0.16.0)
41
+ simple_po_parser (~> 1.1)
42
+ loofah (2.16.0)
43
+ crass (~> 1.0.2)
44
+ nokogiri (>= 1.5.9)
45
+ method_source (1.0.0)
46
+ minitest (5.15.0)
47
+ nokogiri (1.13.3-x86_64-darwin)
48
+ racc (~> 1.4)
49
+ nokogiri (1.13.3-x86_64-linux)
50
+ racc (~> 1.4)
51
+ pry (0.14.1)
52
+ coderay (~> 1.1)
53
+ method_source (~> 1.0)
54
+ racc (1.6.0)
55
+ rack (2.2.3)
56
+ rack-test (1.1.0)
57
+ rack (>= 1.0, < 3)
58
+ rails-dom-testing (2.0.3)
59
+ activesupport (>= 4.2.0)
60
+ nokogiri (>= 1.6)
61
+ rails-html-sanitizer (1.4.2)
62
+ loofah (~> 2.3)
63
+ railties (5.2.7)
64
+ actionpack (= 5.2.7)
65
+ activesupport (= 5.2.7)
66
+ method_source
67
+ rake (>= 0.8.7)
68
+ thor (>= 0.19.0, < 2.0)
69
+ rake (13.0.6)
70
+ rspec (3.11.0)
71
+ rspec-core (~> 3.11.0)
72
+ rspec-expectations (~> 3.11.0)
73
+ rspec-mocks (~> 3.11.0)
74
+ rspec-core (3.11.0)
75
+ rspec-support (~> 3.11.0)
76
+ rspec-expectations (3.11.0)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.11.0)
79
+ rspec-mocks (3.11.1)
80
+ diff-lcs (>= 1.2.0, < 2.0)
81
+ rspec-support (~> 3.11.0)
82
+ rspec-support (3.11.0)
83
+ simple_po_parser (1.1.6)
84
+ sixarm_ruby_unaccent (1.2.0)
85
+ sort_alphabetical (1.1.0)
86
+ unicode_utils (>= 1.2.2)
87
+ thor (1.2.1)
88
+ thread_safe (0.3.6)
89
+ tzinfo (1.2.9)
90
+ thread_safe (~> 0.1)
91
+ unicode_utils (1.4.0)
92
+
93
+ PLATFORMS
94
+ x86_64-darwin-21
95
+ x86_64-linux
96
+
97
+ DEPENDENCIES
98
+ actionpack (~> 5.2)
99
+ country_select!
100
+ pry (~> 0)
101
+ railties (~> 5.2)
102
+ rake (~> 13)
103
+ rspec (~> 3)
104
+
105
+ BUNDLED WITH
106
+ 2.3.10
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => "../"
4
+
5
+ gem "railties", "~> 6.0"
6
+ gem "actionpack", "~> 6.0"
@@ -0,0 +1,107 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ country_select (7.0.0)
5
+ countries (~> 5.0)
6
+ sort_alphabetical (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (6.1.4.6)
12
+ actionview (= 6.1.4.6)
13
+ activesupport (= 6.1.4.6)
14
+ rack (~> 2.0, >= 2.0.9)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (6.1.4.6)
19
+ activesupport (= 6.1.4.6)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activesupport (6.1.4.6)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 1.6, < 2)
27
+ minitest (>= 5.1)
28
+ tzinfo (~> 2.0)
29
+ zeitwerk (~> 2.3)
30
+ builder (3.2.4)
31
+ coderay (1.1.3)
32
+ concurrent-ruby (1.1.10)
33
+ countries (5.0.0)
34
+ i18n_data (~> 0.16.0)
35
+ sixarm_ruby_unaccent (~> 1.1)
36
+ crass (1.0.6)
37
+ diff-lcs (1.5.0)
38
+ erubi (1.10.0)
39
+ i18n (1.10.0)
40
+ concurrent-ruby (~> 1.0)
41
+ i18n_data (0.16.0)
42
+ simple_po_parser (~> 1.1)
43
+ loofah (2.16.0)
44
+ crass (~> 1.0.2)
45
+ nokogiri (>= 1.5.9)
46
+ method_source (1.0.0)
47
+ minitest (5.15.0)
48
+ nokogiri (1.13.3-x86_64-darwin)
49
+ racc (~> 1.4)
50
+ nokogiri (1.13.3-x86_64-linux)
51
+ racc (~> 1.4)
52
+ pry (0.14.1)
53
+ coderay (~> 1.1)
54
+ method_source (~> 1.0)
55
+ racc (1.6.0)
56
+ rack (2.2.3)
57
+ rack-test (1.1.0)
58
+ rack (>= 1.0, < 3)
59
+ rails-dom-testing (2.0.3)
60
+ activesupport (>= 4.2.0)
61
+ nokogiri (>= 1.6)
62
+ rails-html-sanitizer (1.4.2)
63
+ loofah (~> 2.3)
64
+ railties (6.1.4.6)
65
+ actionpack (= 6.1.4.6)
66
+ activesupport (= 6.1.4.6)
67
+ method_source
68
+ rake (>= 0.13)
69
+ thor (~> 1.0)
70
+ rake (13.0.6)
71
+ rspec (3.11.0)
72
+ rspec-core (~> 3.11.0)
73
+ rspec-expectations (~> 3.11.0)
74
+ rspec-mocks (~> 3.11.0)
75
+ rspec-core (3.11.0)
76
+ rspec-support (~> 3.11.0)
77
+ rspec-expectations (3.11.0)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.11.0)
80
+ rspec-mocks (3.11.1)
81
+ diff-lcs (>= 1.2.0, < 2.0)
82
+ rspec-support (~> 3.11.0)
83
+ rspec-support (3.11.0)
84
+ simple_po_parser (1.1.6)
85
+ sixarm_ruby_unaccent (1.2.0)
86
+ sort_alphabetical (1.1.0)
87
+ unicode_utils (>= 1.2.2)
88
+ thor (1.2.1)
89
+ tzinfo (2.0.4)
90
+ concurrent-ruby (~> 1.0)
91
+ unicode_utils (1.4.0)
92
+ zeitwerk (2.5.4)
93
+
94
+ PLATFORMS
95
+ x86_64-darwin-21
96
+ x86_64-linux
97
+
98
+ DEPENDENCIES
99
+ actionpack (~> 6.0)
100
+ country_select!
101
+ pry (~> 0)
102
+ railties (~> 6.0)
103
+ rake (~> 13)
104
+ rspec (~> 3)
105
+
106
+ BUNDLED WITH
107
+ 2.3.10
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => "../"
4
+
5
+ gem "railties", "~> 6.1"
6
+ gem "actionpack", "~> 6.1"
@@ -0,0 +1,107 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ country_select (7.0.0)
5
+ countries (~> 5.0)
6
+ sort_alphabetical (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (6.1.4.6)
12
+ actionview (= 6.1.4.6)
13
+ activesupport (= 6.1.4.6)
14
+ rack (~> 2.0, >= 2.0.9)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (6.1.4.6)
19
+ activesupport (= 6.1.4.6)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activesupport (6.1.4.6)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 1.6, < 2)
27
+ minitest (>= 5.1)
28
+ tzinfo (~> 2.0)
29
+ zeitwerk (~> 2.3)
30
+ builder (3.2.4)
31
+ coderay (1.1.3)
32
+ concurrent-ruby (1.1.10)
33
+ countries (5.0.0)
34
+ i18n_data (~> 0.16.0)
35
+ sixarm_ruby_unaccent (~> 1.1)
36
+ crass (1.0.6)
37
+ diff-lcs (1.5.0)
38
+ erubi (1.10.0)
39
+ i18n (1.10.0)
40
+ concurrent-ruby (~> 1.0)
41
+ i18n_data (0.16.0)
42
+ simple_po_parser (~> 1.1)
43
+ loofah (2.16.0)
44
+ crass (~> 1.0.2)
45
+ nokogiri (>= 1.5.9)
46
+ method_source (1.0.0)
47
+ minitest (5.15.0)
48
+ nokogiri (1.13.3-x86_64-darwin)
49
+ racc (~> 1.4)
50
+ nokogiri (1.13.3-x86_64-linux)
51
+ racc (~> 1.4)
52
+ pry (0.14.1)
53
+ coderay (~> 1.1)
54
+ method_source (~> 1.0)
55
+ racc (1.6.0)
56
+ rack (2.2.3)
57
+ rack-test (1.1.0)
58
+ rack (>= 1.0, < 3)
59
+ rails-dom-testing (2.0.3)
60
+ activesupport (>= 4.2.0)
61
+ nokogiri (>= 1.6)
62
+ rails-html-sanitizer (1.4.2)
63
+ loofah (~> 2.3)
64
+ railties (6.1.4.6)
65
+ actionpack (= 6.1.4.6)
66
+ activesupport (= 6.1.4.6)
67
+ method_source
68
+ rake (>= 0.13)
69
+ thor (~> 1.0)
70
+ rake (13.0.6)
71
+ rspec (3.11.0)
72
+ rspec-core (~> 3.11.0)
73
+ rspec-expectations (~> 3.11.0)
74
+ rspec-mocks (~> 3.11.0)
75
+ rspec-core (3.11.0)
76
+ rspec-support (~> 3.11.0)
77
+ rspec-expectations (3.11.0)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.11.0)
80
+ rspec-mocks (3.11.1)
81
+ diff-lcs (>= 1.2.0, < 2.0)
82
+ rspec-support (~> 3.11.0)
83
+ rspec-support (3.11.0)
84
+ simple_po_parser (1.1.6)
85
+ sixarm_ruby_unaccent (1.2.0)
86
+ sort_alphabetical (1.1.0)
87
+ unicode_utils (>= 1.2.2)
88
+ thor (1.2.1)
89
+ tzinfo (2.0.4)
90
+ concurrent-ruby (~> 1.0)
91
+ unicode_utils (1.4.0)
92
+ zeitwerk (2.5.4)
93
+
94
+ PLATFORMS
95
+ x86_64-darwin-21
96
+ x86_64-linux
97
+
98
+ DEPENDENCIES
99
+ actionpack (~> 6.1)
100
+ country_select!
101
+ pry (~> 0)
102
+ railties (~> 6.1)
103
+ rake (~> 13)
104
+ rspec (~> 3)
105
+
106
+ BUNDLED WITH
107
+ 2.3.10
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => "../"
4
+
5
+ gem "railties", "~> 7.0"
6
+ gem "actionpack", "~> 7.0"
@@ -0,0 +1,107 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ country_select (7.0.0)
5
+ countries (~> 5.0)
6
+ sort_alphabetical (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (7.0.2.3)
12
+ actionview (= 7.0.2.3)
13
+ activesupport (= 7.0.2.3)
14
+ rack (~> 2.0, >= 2.2.0)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (7.0.2.3)
19
+ activesupport (= 7.0.2.3)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activesupport (7.0.2.3)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 1.6, < 2)
27
+ minitest (>= 5.1)
28
+ tzinfo (~> 2.0)
29
+ builder (3.2.4)
30
+ coderay (1.1.3)
31
+ concurrent-ruby (1.1.10)
32
+ countries (5.0.0)
33
+ i18n_data (~> 0.16.0)
34
+ sixarm_ruby_unaccent (~> 1.1)
35
+ crass (1.0.6)
36
+ diff-lcs (1.5.0)
37
+ erubi (1.10.0)
38
+ i18n (1.10.0)
39
+ concurrent-ruby (~> 1.0)
40
+ i18n_data (0.16.0)
41
+ simple_po_parser (~> 1.1)
42
+ loofah (2.16.0)
43
+ crass (~> 1.0.2)
44
+ nokogiri (>= 1.5.9)
45
+ method_source (1.0.0)
46
+ minitest (5.15.0)
47
+ nokogiri (1.13.3-x86_64-darwin)
48
+ racc (~> 1.4)
49
+ nokogiri (1.13.3-x86_64-linux)
50
+ racc (~> 1.4)
51
+ pry (0.14.1)
52
+ coderay (~> 1.1)
53
+ method_source (~> 1.0)
54
+ racc (1.6.0)
55
+ rack (2.2.3)
56
+ rack-test (1.1.0)
57
+ rack (>= 1.0, < 3)
58
+ rails-dom-testing (2.0.3)
59
+ activesupport (>= 4.2.0)
60
+ nokogiri (>= 1.6)
61
+ rails-html-sanitizer (1.4.2)
62
+ loofah (~> 2.3)
63
+ railties (7.0.2.3)
64
+ actionpack (= 7.0.2.3)
65
+ activesupport (= 7.0.2.3)
66
+ method_source
67
+ rake (>= 12.2)
68
+ thor (~> 1.0)
69
+ zeitwerk (~> 2.5)
70
+ rake (13.0.6)
71
+ rspec (3.11.0)
72
+ rspec-core (~> 3.11.0)
73
+ rspec-expectations (~> 3.11.0)
74
+ rspec-mocks (~> 3.11.0)
75
+ rspec-core (3.11.0)
76
+ rspec-support (~> 3.11.0)
77
+ rspec-expectations (3.11.0)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.11.0)
80
+ rspec-mocks (3.11.1)
81
+ diff-lcs (>= 1.2.0, < 2.0)
82
+ rspec-support (~> 3.11.0)
83
+ rspec-support (3.11.0)
84
+ simple_po_parser (1.1.6)
85
+ sixarm_ruby_unaccent (1.2.0)
86
+ sort_alphabetical (1.1.0)
87
+ unicode_utils (>= 1.2.2)
88
+ thor (1.2.1)
89
+ tzinfo (2.0.4)
90
+ concurrent-ruby (~> 1.0)
91
+ unicode_utils (1.4.0)
92
+ zeitwerk (2.5.4)
93
+
94
+ PLATFORMS
95
+ x86_64-darwin-21
96
+ x86_64-linux
97
+
98
+ DEPENDENCIES
99
+ actionpack (~> 7.0)
100
+ country_select!
101
+ pry (~> 0)
102
+ railties (~> 7.0)
103
+ rake (~> 13)
104
+ rspec (~> 3)
105
+
106
+ BUNDLED WITH
107
+ 2.3.10
@@ -7,9 +7,3 @@ git "https://github.com/rails/rails.git" do
7
7
  gem "actionview"
8
8
  gem "activesupport"
9
9
  end
10
-
11
- platforms :rbx do
12
- gem "racc"
13
- gem "rubysl", "~> 2.0"
14
- gem "psych"
15
- end
@@ -0,0 +1,104 @@
1
+ GIT
2
+ remote: https://github.com/rails/rails.git
3
+ revision: bb4a8a91884f3eff2b22d4deb3727d3cc267ddc4
4
+ specs:
5
+ actionpack (7.1.0.alpha)
6
+ actionview (= 7.1.0.alpha)
7
+ activesupport (= 7.1.0.alpha)
8
+ rack (~> 2.0, >= 2.2.0)
9
+ rack-test (>= 0.6.3)
10
+ rails-dom-testing (~> 2.0)
11
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
12
+ actionview (7.1.0.alpha)
13
+ activesupport (= 7.1.0.alpha)
14
+ builder (~> 3.1)
15
+ erubi (~> 1.4)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
18
+ activesupport (7.1.0.alpha)
19
+ concurrent-ruby (~> 1.0, >= 1.0.2)
20
+ i18n (>= 1.6, < 2)
21
+ minitest (>= 5.1)
22
+ tzinfo (~> 2.0)
23
+
24
+ PATH
25
+ remote: ..
26
+ specs:
27
+ country_select (7.0.0)
28
+ countries (~> 5.0)
29
+ sort_alphabetical (~> 1.1)
30
+
31
+ GEM
32
+ remote: https://rubygems.org/
33
+ specs:
34
+ builder (3.2.4)
35
+ coderay (1.1.3)
36
+ concurrent-ruby (1.1.10)
37
+ countries (5.0.0)
38
+ i18n_data (~> 0.16.0)
39
+ sixarm_ruby_unaccent (~> 1.1)
40
+ crass (1.0.6)
41
+ diff-lcs (1.5.0)
42
+ erubi (1.10.0)
43
+ i18n (1.10.0)
44
+ concurrent-ruby (~> 1.0)
45
+ i18n_data (0.16.0)
46
+ simple_po_parser (~> 1.1)
47
+ loofah (2.16.0)
48
+ crass (~> 1.0.2)
49
+ nokogiri (>= 1.5.9)
50
+ method_source (1.0.0)
51
+ minitest (5.15.0)
52
+ nokogiri (1.13.3-x86_64-darwin)
53
+ racc (~> 1.4)
54
+ nokogiri (1.13.3-x86_64-linux)
55
+ racc (~> 1.4)
56
+ pry (0.14.1)
57
+ coderay (~> 1.1)
58
+ method_source (~> 1.0)
59
+ racc (1.6.0)
60
+ rack (2.2.3)
61
+ rack-test (1.1.0)
62
+ rack (>= 1.0, < 3)
63
+ rails-dom-testing (2.0.3)
64
+ activesupport (>= 4.2.0)
65
+ nokogiri (>= 1.6)
66
+ rails-html-sanitizer (1.4.2)
67
+ loofah (~> 2.3)
68
+ rake (13.0.6)
69
+ rspec (3.11.0)
70
+ rspec-core (~> 3.11.0)
71
+ rspec-expectations (~> 3.11.0)
72
+ rspec-mocks (~> 3.11.0)
73
+ rspec-core (3.11.0)
74
+ rspec-support (~> 3.11.0)
75
+ rspec-expectations (3.11.0)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.11.0)
78
+ rspec-mocks (3.11.1)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.11.0)
81
+ rspec-support (3.11.0)
82
+ simple_po_parser (1.1.6)
83
+ sixarm_ruby_unaccent (1.2.0)
84
+ sort_alphabetical (1.1.0)
85
+ unicode_utils (>= 1.2.2)
86
+ tzinfo (2.0.4)
87
+ concurrent-ruby (~> 1.0)
88
+ unicode_utils (1.4.0)
89
+
90
+ PLATFORMS
91
+ x86_64-darwin-21
92
+ x86_64-linux
93
+
94
+ DEPENDENCIES
95
+ actionpack!
96
+ actionview!
97
+ activesupport!
98
+ country_select!
99
+ pry (~> 0)
100
+ rake (~> 13)
101
+ rspec (~> 3)
102
+
103
+ BUNDLED WITH
104
+ 2.3.10
@@ -0,0 +1,10 @@
1
+ module CountrySelect
2
+ DEFAULTS = {
3
+ except: nil,
4
+ format: :default,
5
+ locale: nil,
6
+ only: nil,
7
+ priority_countries: nil,
8
+ priority_countries_divider: "-" * 15
9
+ }
10
+ end
@@ -2,6 +2,8 @@ module CountrySelect
2
2
  FORMATS = {}
3
3
 
4
4
  FORMATS[:default] = lambda do |country|
5
- country.translations[I18n.locale.to_s] || country.name
5
+ # Need to use :[] specifically, not :dig, because country.translations is a
6
+ # ISO3166::Translations object, which overrides :[] to support i18n locale fallbacks
7
+ country.translations&.send(:[], I18n.locale.to_s) || country.common_name || country.iso_short_name
6
8
  end
7
9
  end
@@ -2,8 +2,19 @@ module CountrySelect
2
2
  class CountryNotFoundError < StandardError;end
3
3
  module TagHelper
4
4
  def country_option_tags
5
+ # In Rails 5.2+, `value` accepts no arguments and must also be called
6
+ # with parens to avoid the local variable of the same name
7
+ # https://github.com/rails/rails/pull/29791
8
+ selected_option = @options.fetch(:selected) do
9
+ if self.method(:value).arity == 0
10
+ value()
11
+ else
12
+ value(@object)
13
+ end
14
+ end
15
+
5
16
  option_tags_options = {
6
- :selected => @options.fetch(:selected) { value(@object) },
17
+ :selected => selected_option,
7
18
  :disabled => @options[:disabled]
8
19
  }
9
20
 
@@ -24,27 +35,27 @@ module CountrySelect
24
35
 
25
36
  private
26
37
  def locale
27
- @options[:locale]
38
+ @options.fetch(:locale, ::CountrySelect::DEFAULTS[:locale])
28
39
  end
29
40
 
30
41
  def priority_countries
31
- @options[:priority_countries]
42
+ @options.fetch(:priority_countries, ::CountrySelect::DEFAULTS[:priority_countries])
32
43
  end
33
44
 
34
45
  def priority_countries_divider
35
- @options[:priority_countries_divider] || "-"*15
46
+ @options.fetch(:priority_countries_divider, ::CountrySelect::DEFAULTS[:priority_countries_divider])
36
47
  end
37
48
 
38
49
  def only_country_codes
39
- @options[:only]
50
+ @options.fetch(:only, ::CountrySelect::DEFAULTS[:only])
40
51
  end
41
52
 
42
53
  def except_country_codes
43
- @options[:except]
54
+ @options.fetch(:except, ::CountrySelect::DEFAULTS[:except])
44
55
  end
45
56
 
46
57
  def format
47
- @options[:format] || :default
58
+ @options.fetch(:format, ::CountrySelect::DEFAULTS[:format])
48
59
  end
49
60
 
50
61
  def country_options
@@ -68,9 +79,8 @@ module CountrySelect
68
79
  country_list = country_codes.map do |code_or_name|
69
80
  if country = ISO3166::Country.new(code_or_name)
70
81
  code = country.alpha2
71
- elsif country = ISO3166::Country.find_by_name(code_or_name)
72
- code = country.first
73
- country = ISO3166::Country.new(code)
82
+ elsif country = ISO3166::Country.find_country_by_any_name(code_or_name)
83
+ code = country.alpha2
74
84
  end
75
85
 
76
86
  unless country.present?