unicode_country_flags 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 2d66effa5249ffa8be8bbc484d5dcd8eed25da8e
4
- data.tar.gz: e87a08d74dd7246042e9753d137746ef00bd8a56
3
+ metadata.gz: 0ece4ab4b03996af9337720217ebef47c41d1db6
4
+ data.tar.gz: 249fc501d8913d619d2fa448ae4cd31c9b780a2a
5
5
  SHA512:
6
- metadata.gz: f61e0c6fc3f5fb609d2c3bf2d248ba16bd25fa6770d505a0ad6fe06dcc61b3c4c1d7a7548a69bf8194b8ee30d5c442331e0bf1ed2342d33082df9bd446893043
7
- data.tar.gz: 99b2c2ae58e7a93b751a35465e945842693d1df8b5e34900621fed2bd632ba52317113d809b056bec77f1b3fbce71be56638176fb3684a99ac0a3a7e15249913
6
+ metadata.gz: 874cac5d4c1f5d6321cd42ce7c5c11b53cb028f38fe1ff054eba4d5524c36d711773bc3471d7b73aea657297456bd8f7d7595f8395ff6a194f26bfc7d258c41c
7
+ data.tar.gz: d8582df21dbccbaa8c3f3dafb633f8eac3509d44148cbc472ab7e38d91df4a4091eb569f4159985da4dee8cd635588f69f627f39ca3ded9c6a896a916e1b64cf
@@ -1,2 +1,4 @@
1
1
  require "unicode_country_flags/version"
2
+ require "unicode_country_flags/country_flags"
3
+ require "unicode_country_flags/helpers"
2
4
  require "unicode_country_flags/engine" if defined?(::Rails)
@@ -4,7 +4,12 @@ module UnicodeCountryFlags
4
4
  def flag_of(code)
5
5
  code = code.to_s.downcase
6
6
  return unless code.size == 2
7
- code.chars.map { |c| unicodes[c] }.join("")
7
+ chars = code.chars.map { |c| unicodes[c] }
8
+ if chars.any?(&:nil?)
9
+ nil
10
+ else
11
+ chars.join
12
+ end
8
13
  end
9
14
 
10
15
  def unicodes
@@ -1,5 +1,3 @@
1
- require "unicode_country_flags/helpers"
2
-
3
1
  module UnicodeCountryFlags
4
2
  class Engine < ::Rails::Engine
5
3
  initializer 'unicode_country_flags.initialize' do
@@ -2,7 +2,8 @@ require "unicode_country_flags/country_flags"
2
2
  module UnicodeCountryFlags
3
3
  module Helpers
4
4
  def unicode_country_flag_of(code)
5
- UnicodeCountryFlags::CountryFlags.flag_of(code).html_safe
5
+ flag = UnicodeCountryFlags::CountryFlags.flag_of(code)
6
+ flag.html_safe if flag
6
7
  end
7
8
  end
8
9
  end
@@ -1,3 +1,3 @@
1
1
  module UnicodeCountryFlags
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicode_country_flags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yanhao Yang