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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ece4ab4b03996af9337720217ebef47c41d1db6
|
4
|
+
data.tar.gz: 249fc501d8913d619d2fa448ae4cd31c9b780a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874cac5d4c1f5d6321cd42ce7c5c11b53cb028f38fe1ff054eba4d5524c36d711773bc3471d7b73aea657297456bd8f7d7595f8395ff6a194f26bfc7d258c41c
|
7
|
+
data.tar.gz: d8582df21dbccbaa8c3f3dafb633f8eac3509d44148cbc472ab7e38d91df4a4091eb569f4159985da4dee8cd635588f69f627f39ca3ded9c6a896a916e1b64cf
|
@@ -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] }
|
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
|
@@ -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)
|
5
|
+
flag = UnicodeCountryFlags::CountryFlags.flag_of(code)
|
6
|
+
flag.html_safe if flag
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|