flag-icons-rails 3.4.6 → 3.4.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d5c0302edc781f2fa1d0b35f962dd2fc8721325f84402159ff2f0d7f8ec49a9
4
- data.tar.gz: d29036f7ca5a468e82024d911dd472431c756e85effbf2a2010ce60541899275
3
+ metadata.gz: 001ee1037c690bde826af00bc52d720c8bc9e9b7a48bf30a53be4f7293054e24
4
+ data.tar.gz: d7a01bf076ad364284e10caa1e6b1534df5dc72cd34268ff0a4181102c546d41
5
5
  SHA512:
6
- metadata.gz: 61ad3566d9018ab0e38eb4417da2972a9913f431e0fac9f284b13c761aadbd0795cc396fc1036e5b312ef0fd4df0a3143867d7066ee65c341739c04f9ae40e97
7
- data.tar.gz: ae2014eb8144a3bf565d495bd014ce2be46c43c2f9340bf9e6dbfb2a1ea7d831b5fdf26f03f351a3aae235c2805f5a07dd22a45729f85c446c939c0ed89708bf
6
+ metadata.gz: f492ee59ab00e0f1e74705f19c2798a84de18b0b4e985e5bfcfb403f51e0ed60ccc024439aecf8609b9319cbbe27d66484e417796225712916d81af0294eba9e
7
+ data.tar.gz: 4c78926868077bcd0919a359e5841cc47d90515488c7d610d5db09ac845d5332b7f6fdc98765693ea91f030ff8c1dd0261857d0f3082142d510c4874fc43ee9c
data/README.md CHANGED
@@ -63,6 +63,11 @@ flag_icon(:by)
63
63
  # => <span class="flag-icon flag-icon-by"></span>
64
64
  ```
65
65
 
66
+ ```ruby
67
+ flag_icon(:by, element: :div)
68
+ # => <div class="flag-icon flag-icon-by"></div>
69
+ ```
70
+
66
71
  ```ruby
67
72
  flag_icon(:by, squared: true)
68
73
  # => <span class="flag-icon flag-icon-by flag-icon-squared"></span>
@@ -3,19 +3,21 @@
3
3
  module FlagIconsRails
4
4
  module Rails
5
5
  module ViewHelpers
6
- # Helper to render flag icon
6
+ # Helper to render flag icon as single HTML element
7
7
  #
8
- # @param [Symbol|String] country_code {https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2}
9
- # country code
10
- # @param [true, false] :squared Optional. It is used to determine squared or rectangle version
11
- # of flag will be rendered, defaults to +false+
8
+ # @param [Symbol|String] country_code ISO 3166-1 alpha-2 country code, see:
9
+ # https://www.iso.org/obp/ui/#search
10
+ # @param [true, false] squared Optional. It is used to determine if square or rectangular
11
+ # version of flag will be rendered, defaults to +false+
12
+ # @param [Symbol|String] element Optional. HTML element to generate and apply classes to,
13
+ # defaults to +:span+
12
14
  # @param [Hash] html_options Optional. HTML options applied to rendered span, defaults to +{}+
13
15
  #
14
- # @return [String] +span+ with requested HTML options to display country flag
15
- def flag_icon(country_code, squared: false, **html_options)
16
+ # @return [String] +element+ with requested HTML options to display country flag
17
+ def flag_icon(country_code, squared: false, element: :span, **html_options)
16
18
  html_options[:class] = flag_icon_content_class(country_code, squared, html_options[:class])
17
19
 
18
- content_tag(:span, nil, html_options)
20
+ content_tag(element, nil, html_options)
19
21
  end
20
22
 
21
23
  private
@@ -23,12 +25,12 @@ module FlagIconsRails
23
25
  def flag_icon_content_class(country_code, squared, custom_css_class)
24
26
  content_classes = [
25
27
  'flag-icon',
26
- "flag-icon-#{country_code}",
27
- (squared == true ? 'flag-icon-squared' : ''),
28
+ "flag-icon-#{country_code}".downcase,
29
+ (squared ? 'flag-icon-squared' : ''),
28
30
  custom_css_class
29
31
  ]
30
32
 
31
- content_classes.join(' ').strip
33
+ content_classes.join(' ').squish
32
34
  end
33
35
  end
34
36
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FlagIconsRails
4
- VERSION = '3.4.6'.freeze
4
+ VERSION = '3.4.6.1'.freeze
5
5
  FLAG_ICONS_CSS_VERSION = '3.4.6'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flag-icons-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.6
4
+ version: 3.4.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Garlukovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-15 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass-rails
@@ -694,7 +694,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
694
694
  - !ruby/object:Gem::Version
695
695
  version: '0'
696
696
  requirements: []
697
- rubygems_version: 3.0.4
697
+ rubygems_version: 3.0.8
698
698
  signing_key:
699
699
  specification_version: 4
700
700
  summary: Gem to use `flag-icon-css` library in your Rails projects