flag_icon 1.0.0 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb275d7c19f1435cf9531f4d7aafce60d773c743a255b36e3aac91245b74a507
4
- data.tar.gz: 6a7a47c3c911a5e1b97d21884c2a0486a1f58c8dafde04dc88690a1be5e8a8aa
3
+ metadata.gz: a681cfb4be4dd25f03cf0fa2f036764b178f3ef23a0d394d86f3cf4ef49a5af1
4
+ data.tar.gz: 2e70a4e0530292e43f787b25c0df6b9711c03a370013d52d4fd5bdc0278d1903
5
5
  SHA512:
6
- metadata.gz: f0aaab933540e278cbb15aec7b154f860153eeb04b741ebf62736dc24b59743e0c5a7bfc5bf6c809b7d133e307d214e567bfbd07945eead37da2a7ef13ab6a24
7
- data.tar.gz: 7097374454799947115f3bb6b6644b11746e725b73044f220e01e7a736334fda7ab7c6d28c4a3f1caa8d603f1347c9cf20130d2fea3d432f059509d0b4d2485e
6
+ metadata.gz: f752bd8917b096e03085653d41447d6993177453d7851e2959a2b73f3a346b55687d9b146bde7ceb951aadac5542a736763e4089100f65912ea149192f09a99a
7
+ data.tar.gz: 662475aff393e6c27e455a382fcd63a682f08d24b55208ddb9049ca2a58bfa06c14656943d6f9d90370e5397df53d90836a8ca5d04a37cd6cef0d8fc5fde9b9c
@@ -1,25 +1,22 @@
1
- name: Ruby
1
+ name: Run tests
2
2
 
3
3
  on:
4
4
  push:
5
5
  branches:
6
- - main
6
+ - '*'
7
+ - '!master'
8
+
7
9
 
8
10
  jobs:
9
11
  build:
10
12
  runs-on: ubuntu-latest
11
13
 
12
- strategy:
13
- matrix:
14
- ruby:
15
- - 3.0.3
16
-
17
14
  steps:
18
15
  - uses: actions/checkout@v2
19
16
  - name: Set up Ruby
20
17
  uses: ruby/setup-ruby@v1
21
18
  with:
22
- ruby-version: ${{ matrix.ruby }}
19
+ ruby-version: 3.0.3
23
20
  bundler-cache: true
24
21
  - name: Run the default task
25
22
  run: bundle exec rake
@@ -0,0 +1,33 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ packages: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 3.0.3
20
+ bundler-cache: true
21
+ - name: Run the default task
22
+ run: bundle exec rake
23
+
24
+ - name: Publish to RubyGems
25
+ run: |
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
+ gem build flag_icon.gemspec
31
+ gem push *.gem
32
+ env:
33
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.3
data/Gemfile CHANGED
@@ -2,5 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
+ ruby '3.0.3'
6
+
5
7
  # Specify your gem's dependencies in flag_icon.gemspec
6
8
  gemspec
data/Gemfile.lock CHANGED
@@ -1,13 +1,122 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flag_icon (1.1.1)
4
+ flag_icon (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ actioncable (6.1.4.1)
10
+ actionpack (= 6.1.4.1)
11
+ activesupport (= 6.1.4.1)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.1.4.1)
15
+ actionpack (= 6.1.4.1)
16
+ activejob (= 6.1.4.1)
17
+ activerecord (= 6.1.4.1)
18
+ activestorage (= 6.1.4.1)
19
+ activesupport (= 6.1.4.1)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.1.4.1)
22
+ actionpack (= 6.1.4.1)
23
+ actionview (= 6.1.4.1)
24
+ activejob (= 6.1.4.1)
25
+ activesupport (= 6.1.4.1)
26
+ mail (~> 2.5, >= 2.5.4)
27
+ rails-dom-testing (~> 2.0)
28
+ actionpack (6.1.4.1)
29
+ actionview (= 6.1.4.1)
30
+ activesupport (= 6.1.4.1)
31
+ rack (~> 2.0, >= 2.0.9)
32
+ rack-test (>= 0.6.3)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
+ actiontext (6.1.4.1)
36
+ actionpack (= 6.1.4.1)
37
+ activerecord (= 6.1.4.1)
38
+ activestorage (= 6.1.4.1)
39
+ activesupport (= 6.1.4.1)
40
+ nokogiri (>= 1.8.5)
41
+ actionview (6.1.4.1)
42
+ activesupport (= 6.1.4.1)
43
+ builder (~> 3.1)
44
+ erubi (~> 1.4)
45
+ rails-dom-testing (~> 2.0)
46
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
+ activejob (6.1.4.1)
48
+ activesupport (= 6.1.4.1)
49
+ globalid (>= 0.3.6)
50
+ activemodel (6.1.4.1)
51
+ activesupport (= 6.1.4.1)
52
+ activerecord (6.1.4.1)
53
+ activemodel (= 6.1.4.1)
54
+ activesupport (= 6.1.4.1)
55
+ activestorage (6.1.4.1)
56
+ actionpack (= 6.1.4.1)
57
+ activejob (= 6.1.4.1)
58
+ activerecord (= 6.1.4.1)
59
+ activesupport (= 6.1.4.1)
60
+ marcel (~> 1.0.0)
61
+ mini_mime (>= 1.1.0)
62
+ activesupport (6.1.4.1)
63
+ concurrent-ruby (~> 1.0, >= 1.0.2)
64
+ i18n (>= 1.6, < 2)
65
+ minitest (>= 5.1)
66
+ tzinfo (~> 2.0)
67
+ zeitwerk (~> 2.3)
68
+ builder (3.2.4)
69
+ concurrent-ruby (1.1.9)
70
+ crass (1.0.6)
9
71
  diff-lcs (1.5.0)
10
72
  docile (1.4.0)
73
+ erubi (1.10.0)
74
+ globalid (1.0.0)
75
+ activesupport (>= 5.0)
76
+ i18n (1.8.11)
77
+ concurrent-ruby (~> 1.0)
78
+ loofah (2.13.0)
79
+ crass (~> 1.0.2)
80
+ nokogiri (>= 1.5.9)
81
+ mail (2.7.1)
82
+ mini_mime (>= 0.1.1)
83
+ marcel (1.0.2)
84
+ method_source (1.0.0)
85
+ mini_mime (1.1.2)
86
+ minitest (5.15.0)
87
+ nio4r (2.5.8)
88
+ nokogiri (1.13.0-x86_64-linux)
89
+ racc (~> 1.4)
90
+ racc (1.6.0)
91
+ rack (2.2.3)
92
+ rack-test (1.1.0)
93
+ rack (>= 1.0, < 3)
94
+ rails (6.1.4.1)
95
+ actioncable (= 6.1.4.1)
96
+ actionmailbox (= 6.1.4.1)
97
+ actionmailer (= 6.1.4.1)
98
+ actionpack (= 6.1.4.1)
99
+ actiontext (= 6.1.4.1)
100
+ actionview (= 6.1.4.1)
101
+ activejob (= 6.1.4.1)
102
+ activemodel (= 6.1.4.1)
103
+ activerecord (= 6.1.4.1)
104
+ activestorage (= 6.1.4.1)
105
+ activesupport (= 6.1.4.1)
106
+ bundler (>= 1.15.0)
107
+ railties (= 6.1.4.1)
108
+ sprockets-rails (>= 2.0.0)
109
+ rails-dom-testing (2.0.3)
110
+ activesupport (>= 4.2.0)
111
+ nokogiri (>= 1.6)
112
+ rails-html-sanitizer (1.4.2)
113
+ loofah (~> 2.3)
114
+ railties (6.1.4.1)
115
+ actionpack (= 6.1.4.1)
116
+ activesupport (= 6.1.4.1)
117
+ method_source
118
+ rake (>= 0.13)
119
+ thor (~> 1.0)
11
120
  rake (13.0.6)
12
121
  rspec (3.10.0)
13
122
  rspec-core (~> 3.10.0)
@@ -28,15 +137,33 @@ GEM
28
137
  simplecov_json_formatter (~> 0.1)
29
138
  simplecov-html (0.12.3)
30
139
  simplecov_json_formatter (0.1.3)
140
+ sprockets (4.0.2)
141
+ concurrent-ruby (~> 1.0)
142
+ rack (> 1, < 3)
143
+ sprockets-rails (3.4.2)
144
+ actionpack (>= 5.2)
145
+ activesupport (>= 5.2)
146
+ sprockets (>= 3.0.0)
147
+ thor (1.2.1)
148
+ tzinfo (2.0.4)
149
+ concurrent-ruby (~> 1.0)
150
+ websocket-driver (0.7.5)
151
+ websocket-extensions (>= 0.1.0)
152
+ websocket-extensions (0.1.5)
153
+ zeitwerk (2.5.1)
31
154
 
32
155
  PLATFORMS
33
156
  x86_64-linux
34
157
 
35
158
  DEPENDENCIES
36
159
  flag_icon!
160
+ rails (~> 6.1)
37
161
  rake (~> 13.0)
38
162
  rspec (~> 3.0)
39
- simplecov
163
+ simplecov (~> 0.21)
164
+
165
+ RUBY VERSION
166
+ ruby 3.0.3p157
40
167
 
41
168
  BUNDLED WITH
42
- 2.2.22
169
+ 2.2.32
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 TODO: Write your name
3
+ Copyright (c) 2022 Movie buff
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # FlagIcon
2
+ An attempt to map languages to flags!
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/flag_icon`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
4
 
7
5
  ## Installation
8
6
 
@@ -21,18 +19,94 @@ Or install it yourself as:
21
19
  $ gem install flag_icon
22
20
 
23
21
  ## Usage
22
+ There is a number of helpers available that will render country names, language names and flags given a country code or locale.
24
23
 
25
- TODO: Write usage instructions here
24
+ ```ruby
25
+ # It returns HTML element with country icon and title
26
+ #
27
+ # @param code -> language locale
28
+ # @example language_icon('el')
29
+ # @return String
30
+ language_icon
31
+ ```
32
+ ```ruby
33
+ # It returns HTML element with country icon
34
+ #
35
+ # @param code -> country iso code
36
+ # @example flag_icon('gr')
37
+ # @return String
38
+ flag_icon
39
+ ```
40
+ ```ruby
41
+ # It returns the language name
42
+ #
43
+ # @param code -> language locale
44
+ # @example language_name('el') # => Greek
45
+ # @return String
46
+ language_name
47
+ ```
48
+ ```ruby
49
+ # It returns the country name
50
+ #
51
+ # @param code -> country iso code
52
+ # @example language_name('gr') # => Greece
53
+ # @return String
54
+ country_name
55
+ ```
56
+ ```ruby
57
+ # It returns the country iso code
58
+ #
59
+ # @param code -> language locale
60
+ # @example language_name('el') # => gr
61
+ # @return String
62
+ language_flag
63
+ ```
64
+ ```ruby
65
+ # It returns the country iso code
66
+ #
67
+ # @param popular -> title of the popular group
68
+ # @param available -> title of the available group
69
+ # @example select_language
70
+ # @return Hash
71
+ select_language
72
+ ```
73
+ ```ruby
74
+ # Define in your application_helper to override the popular languages
75
+ # Default: [['English', :en], ['Spanish', :es]]
76
+ #
77
+ # @example
78
+ # def popular_languages
79
+ # [['English', :en], ['Spanish', :es]]
80
+ # end
81
+ # @return Array
82
+ popular_languages
83
+ ```
84
+ ```ruby
85
+ # Define in your application_helper to override the available languages
86
+ # @example [['English', :en], ['Spanish', :es]] #default
87
+ # @example
88
+ # def available_languages
89
+ # Language.all.order(:language_locale).pluck(:language_locale)
90
+ # end
91
+ # @return Array
92
+ available_languages
26
93
 
94
+ ```
27
95
  ## Development
28
96
 
29
97
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
98
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
99
  ## Contributing
100
+ Matching flags to languages can be really tricky and even problematic sometimes because there is no direct association
101
+ between languages and countries since the same language is spoken in many countries and many languages are spoken in a single.
102
+ So a effort was made to identify the official language of each country and then assign the flag to the language not the country.
103
+
104
+ So for a title from Mexico which has spanish as the official language the spanish flag will appear.
105
+
106
+ Therefore if you notice any flags being mismatched please raise an [issue](https://github.com/alexwebgr/flag_icon/issues)
107
+ or even better open a [pull request](https://github.com/alexwebgr/flag_icon/pulls)
34
108
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/flag_icon. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/flag_icon/blob/master/CODE_OF_CONDUCT.md).
109
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/alexwebgr/flag_icon/blob/master/CODE_OF_CONDUCT.md).
36
110
 
37
111
  ## License
38
112
 
@@ -40,4 +114,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
114
 
41
115
  ## Code of Conduct
42
116
 
43
- Everyone interacting in the FlagIcon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/flag_icon/blob/master/CODE_OF_CONDUCT.md).
117
+ Everyone interacting in the FlagIcon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/alexwebgr/flag_icon/blob/master/CODE_OF_CONDUCT.md).
118
+
119
+ ## Credits
120
+ * Flag icons and css from [flag-icons](https://github.com/lipis/flag-icons)
121
+ * Country names [xqisocodes.html](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
122
+ * Language to country mapping [country_locale_map.json](https://github.com/riboseinc/country_to_locales_mapping/blob/master/data/country_locale_map.json)
123
+ * Language to country mapping [language-identifiers.html](http://www.i18nguy.com/unicode/language-identifiers.html)
124
+
data/flag_icon.gemspec CHANGED
@@ -28,7 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib", '"vendor"']
30
30
 
31
+ spec.add_development_dependency "rails", "~> 6.1"
31
32
  spec.add_development_dependency "rake", "~> 13.0"
32
33
  spec.add_development_dependency "rspec", "~> 3.0"
33
- spec.add_development_dependency "simplecov"
34
+ spec.add_development_dependency "simplecov", "~> 0.21"
34
35
  end
@@ -0,0 +1,93 @@
1
+ module FlagIcon
2
+ # It returns the language name
3
+ #
4
+ # @param code -> language locale
5
+ # @example language_name('el') # => Greek
6
+ # @return String
7
+ def language_name(code)
8
+ FlagIcon::Countries::LANGUAGES[code.to_sym]
9
+ end
10
+
11
+ # It returns the country name
12
+ #
13
+ # @param code -> country iso code
14
+ # @example language_name('gr') # => Greece
15
+ # @return String
16
+ def country_name(code)
17
+ FlagIcon::Countries::NAMES[code.to_sym]
18
+ end
19
+
20
+ # It returns the country iso code
21
+ #
22
+ # @param code -> language locale
23
+ # @example language_name('el') # => gr
24
+ # @return String
25
+ def language_flag(code)
26
+ FlagIcon::Countries::LANGUAGE_FLAGS[code.to_sym]
27
+ end
28
+
29
+ # It returns the country iso code
30
+ #
31
+ # @param popular -> title of the popular group
32
+ # @param available -> title of the available group
33
+ # @example select_language
34
+ # @return Hash
35
+ def select_language(popular = 'Popular', available = 'Available')
36
+ {
37
+ popular => popular_languages,
38
+ available => available_languages.map { |lang| [language_name(lang), lang] }
39
+ }
40
+ end
41
+
42
+
43
+ # It returns HTML element with country icon and title
44
+ #
45
+ # @param code -> language locale
46
+ # @example language_icon('el')
47
+ # @return String
48
+ def language_icon(code)
49
+ "<span class='flag-icon flag-icon-#{language_flag(code)}' title='Audio language - #{language_name(code)}'></span>"
50
+ end
51
+
52
+ # It returns HTML element with country icon
53
+ #
54
+ # @param code -> country iso code
55
+ # @example flag_icon('gr')
56
+ # @return String
57
+ def flag_icon(code)
58
+ "<span class='flag-icon flag-icon-#{code}' title='Available in #{country_name(code)}'></span>"
59
+ end
60
+
61
+ # Define in your application_helper to override the popular languages
62
+ # Default: [['English', :en], ['Spanish', :es]]
63
+ #
64
+ # @example
65
+ # def popular_languages
66
+ # [['English', :en], ['Spanish', :es]]
67
+ # end
68
+ # @return Array
69
+ def popular_languages
70
+ [['English', :en], ['Spanish', :es]]
71
+ end
72
+
73
+ # Define in your application_helper to override the available languages
74
+ # @example [['English', :en], ['Spanish', :es]] #default
75
+ # @example
76
+ # def available_languages
77
+ # Language.all.order(:language_locale).pluck(:language_locale)
78
+ # end
79
+ # @return Array
80
+ def available_languages
81
+ @languages ||= FlagIcon::Countries::LANGUAGES.keys
82
+ end
83
+
84
+ # exposed methods for testing
85
+ module_function :language_name
86
+ module_function :country_name
87
+ module_function :language_flag
88
+ module_function :select_language
89
+ module_function :language_icon
90
+ module_function :flag_icon
91
+ module_function :popular_languages
92
+ module_function :available_languages
93
+ end
@@ -1,5 +1,5 @@
1
1
  module FlagIcon
2
2
  module Rails
3
- VERSION = "1.0.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -1,9 +1,9 @@
1
1
  require 'rails'
2
- require "flag_icon/helper"
2
+ require "flag_icon/helpers"
3
3
 
4
4
  module FlagIcon
5
5
  class Railtie < ::Rails::Railtie
6
- initializer "flag_icon.helper" do
6
+ initializer "flag_icon.helpers" do
7
7
  ActionView::Base.send :include, FlagIcon
8
8
  end
9
9
  end
data/lib/flag_icon.rb CHANGED
@@ -1,4 +1,7 @@
1
- require "flag_icon/helper"
1
+ require "flag_icon/helpers"
2
2
  require "flag_icon/countries"
3
3
  require "flag_icon/railtie"
4
4
  require 'flag_icon/rails'
5
+
6
+ module FlagIcon
7
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flag_icon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexwebgr
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-08 00:00:00.000000000 Z
11
+ date: 2022-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.1'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +56,16 @@ dependencies:
42
56
  name: simplecov
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ">="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: '0.21'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: '0.21'
55
69
  description: A gem that contains view helpers for language names, country names and
56
70
  language to flags
57
71
  email:
@@ -61,8 +75,10 @@ extensions: []
61
75
  extra_rdoc_files: []
62
76
  files:
63
77
  - ".github/workflows/main.yml"
78
+ - ".github/workflows/publish.yml"
64
79
  - ".gitignore"
65
80
  - ".rspec"
81
+ - ".ruby-version"
66
82
  - CODE_OF_CONDUCT.md
67
83
  - Gemfile
68
84
  - Gemfile.lock
@@ -72,7 +88,7 @@ files:
72
88
  - flag_icon.gemspec
73
89
  - lib/flag_icon.rb
74
90
  - lib/flag_icon/countries.rb
75
- - lib/flag_icon/helper.rb
91
+ - lib/flag_icon/helpers.rb
76
92
  - lib/flag_icon/rails.rb
77
93
  - lib/flag_icon/rails/engine.rb
78
94
  - lib/flag_icon/rails/version.rb
@@ -360,7 +376,7 @@ licenses:
360
376
  metadata:
361
377
  homepage_uri: https://github.com/alexwebgr/flag_icon
362
378
  source_code_uri: https://github.com/alexwebgr/flag_icon
363
- post_install_message:
379
+ post_install_message:
364
380
  rdoc_options: []
365
381
  require_paths:
366
382
  - lib
@@ -376,8 +392,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
376
392
  - !ruby/object:Gem::Version
377
393
  version: '0'
378
394
  requirements: []
379
- rubygems_version: 3.2.22
380
- signing_key:
395
+ rubygems_version: 3.2.32
396
+ signing_key:
381
397
  specification_version: 4
382
398
  summary: An attempt to map languages to country flags
383
399
  test_files: []
@@ -1,40 +0,0 @@
1
- module FlagIcon
2
- private
3
-
4
- def language_name(code)
5
- FlagIcon::Countries::LANGUAGES[code.to_sym]
6
- end
7
-
8
- def country_name(code)
9
- FlagIcon::Countries::NAMES[code.to_sym]
10
- end
11
-
12
- def language_flag(code)
13
- FlagIcon::Countries::LANGUAGE_FLAGS[code.to_sym]
14
- end
15
-
16
- def select_language
17
- {
18
- 'Popular' => popular_languages,
19
- 'Available' => available_languages.map { |lang| [language_name(lang), lang] }
20
- }
21
- end
22
-
23
- def language_icon(code)
24
- "<span class='flag-icon flag-icon-#{language_flag(code)}' title='Audio language - #{language_name(code)}'></span>"
25
- end
26
-
27
- def flag_icon(code)
28
- "<span class='flag-icon flag-icon-#{code}' title='Available in #{country_name(code)}'></span>"
29
- end
30
-
31
- public
32
-
33
- def popular_languages
34
- [['English', :en], ['Spanish', :es]]
35
- end
36
-
37
- def available_languages
38
- @languages ||= FlagIcon::Countries::LANGUAGES.keys
39
- end
40
- end