unicode-emoji 0.9.3 β 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -13
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/unicode/emoji.rb +3 -10
- data/lib/unicode/emoji/constants.rb +1 -1
- data/spec/unicode_emoji_spec.rb +22 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6af04d4f8c8c5ec38b45e1b396af541a9b8c8a57e85651e1b7e472c8cfce28d
|
4
|
+
data.tar.gz: db9033bc0bfceacbede4c4ecbecae2358733539b9b0b4ce16622369fae8ca0ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca0b1e5c9b5be9c77845755315ec5a639ba34ed349298f2430841cc5f650efc5a4dd5658b872712b68cec3239fb5d33735a1c52e55925e57ef8588d9555e7f5a
|
7
|
+
data.tar.gz: 001756b53f178b3be3e5625952e2985d9103d9b7324e640acb9aed591ff584c36c3c1e294b936233bce3823fec66649a33b672571679af20ed65b59af6e38736
|
data/.travis.yml
CHANGED
@@ -3,23 +3,14 @@ language: ruby
|
|
3
3
|
|
4
4
|
rvm:
|
5
5
|
- ruby-head
|
6
|
-
- 2.5.
|
7
|
-
- 2.4.
|
8
|
-
- 2.3.
|
9
|
-
- 2.2
|
10
|
-
- 2.1
|
11
|
-
- 2.0
|
6
|
+
- 2.5.1
|
7
|
+
- 2.4.4
|
8
|
+
- 2.3.7
|
12
9
|
- jruby-head
|
13
|
-
- jruby-9.1.
|
14
|
-
|
15
|
-
cache:
|
16
|
-
- bundler
|
10
|
+
- jruby-9.1.16.0
|
17
11
|
|
18
12
|
matrix:
|
19
13
|
allow_failures:
|
20
14
|
- rvm: jruby-head
|
21
15
|
- rvm: ruby-head
|
22
|
-
- rvm: 2.1
|
23
|
-
- rvm: 2.0
|
24
16
|
# fast_finish: true
|
25
|
-
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,9 +6,9 @@ Also includes a categorized list of recommended Emoji.
|
|
6
6
|
|
7
7
|
Emoji version: **5.0**
|
8
8
|
|
9
|
-
Supported Rubies: **2.5**, **2.4**, **2.3
|
9
|
+
Supported Rubies: **2.5**, **2.4**, **2.3**
|
10
10
|
|
11
|
-
|
11
|
+
If you are stuck on an older Ruby version, checkout the latest [0.9 version](https://rubygems.org/gems/unicode-emoji/versions/0.9.3) of this gem.
|
12
12
|
|
13
13
|
## Gemfile
|
14
14
|
|
data/lib/unicode/emoji.rb
CHANGED
@@ -31,7 +31,7 @@ module Unicode
|
|
31
31
|
RECOMMENDED_SUBDIVISION_FLAGS = INDEX[:TAGS].freeze
|
32
32
|
RECOMMENDED_ZWJ_SEQUENCES = INDEX[:ZWJ].freeze
|
33
33
|
|
34
|
-
LIST = INDEX[:LIST].freeze.
|
34
|
+
LIST = INDEX[:LIST].freeze.each_value(&:freeze)
|
35
35
|
|
36
36
|
pack = ->(ord){ Regexp.escape(Array(ord).pack("U*")) }
|
37
37
|
join = -> (*strings){ "(?:" + strings.join("|") + ")" }
|
@@ -138,15 +138,8 @@ module Unicode
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def self.list(key = nil, sub_key = nil)
|
141
|
-
|
142
|
-
|
143
|
-
LIST[key][sub_key]
|
144
|
-
else
|
145
|
-
LIST[key]
|
146
|
-
end
|
147
|
-
else
|
148
|
-
LIST
|
149
|
-
end
|
141
|
+
return LIST unless key || sub_key
|
142
|
+
LIST.dig(*[key, sub_key].compact)
|
150
143
|
end
|
151
144
|
|
152
145
|
def self.get_codepoint_value(char)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Unicode
|
4
4
|
module Emoji
|
5
|
-
VERSION = "0.
|
5
|
+
VERSION = "1.0.0".freeze
|
6
6
|
EMOJI_VERSION = "5.0".freeze
|
7
7
|
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + '/../../../data/').freeze
|
8
8
|
INDEX_FILENAME = (DATA_DIRECTORY + '/emoji.marshal.gz').freeze
|
data/spec/unicode_emoji_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require "minitest/autorun"
|
|
3
3
|
|
4
4
|
describe Unicode::Emoji do
|
5
5
|
describe ".properties" do
|
6
|
-
it "
|
6
|
+
it "returns an Array for Emoji properties if has codepoints" do
|
7
7
|
assert_equal ["Emoji", "Emoji_Presentation"], Unicode::Emoji.properties("π΄")
|
8
8
|
assert_equal ["Emoji"], Unicode::Emoji.properties("β ")
|
9
9
|
end
|
10
10
|
|
11
|
-
it "
|
11
|
+
it "returns nil for Emoji properties if has no codepoints" do
|
12
12
|
assert_nil Unicode::Emoji.properties("A")
|
13
13
|
end
|
14
14
|
end
|
@@ -24,7 +24,7 @@ describe Unicode::Emoji do
|
|
24
24
|
assert_equal "π΄\u{FE0F}", $&
|
25
25
|
end
|
26
26
|
|
27
|
-
it "does not match singleton emoji
|
27
|
+
it "does not match singleton emoji in combination with text variation selector" do
|
28
28
|
"π΄\u{FE0E} sleeping face" =~ Unicode::Emoji::REGEX
|
29
29
|
assert_nil $&
|
30
30
|
end
|
@@ -34,7 +34,7 @@ describe Unicode::Emoji do
|
|
34
34
|
assert_nil $&
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "matches textual singleton emoji in combination with emoji variation selector" do
|
38
38
|
"βΆ\u{FE0F} play button" =~ Unicode::Emoji::REGEX
|
39
39
|
assert_equal "βΆ\u{FE0F}", $&
|
40
40
|
end
|
@@ -44,7 +44,7 @@ describe Unicode::Emoji do
|
|
44
44
|
assert_nil $&
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "matches modified emoji if modifier base emoji is used" do
|
48
48
|
"ππ½ person in bed: medium skin tone" =~ Unicode::Emoji::REGEX
|
49
49
|
assert_equal "ππ½", $&
|
50
50
|
end
|
@@ -54,7 +54,7 @@ describe Unicode::Emoji do
|
|
54
54
|
assert_equal "π΅", $&
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "matches valid region flags" do
|
58
58
|
"π΅πΉ Portugal" =~ Unicode::Emoji::REGEX
|
59
59
|
assert_equal "π΅πΉ", $&
|
60
60
|
end
|
@@ -64,27 +64,27 @@ describe Unicode::Emoji do
|
|
64
64
|
assert_nil $&
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "matches emoji keycap sequences" do
|
68
68
|
"2οΈβ£ keycap: 2" =~ Unicode::Emoji::REGEX
|
69
69
|
assert_equal "2οΈβ£", $&
|
70
70
|
end
|
71
71
|
|
72
|
-
it "
|
72
|
+
it "matches recommended tag sequences" do
|
73
73
|
"π΄σ §σ ’σ ³σ £σ ΄σ Ώ Scotland" =~ Unicode::Emoji::REGEX
|
74
74
|
assert_equal "π΄σ §σ ’σ ³σ £σ ΄σ Ώ", $&
|
75
75
|
end
|
76
76
|
|
77
|
-
it "does not match valid tag sequences
|
77
|
+
it "does not match valid tag sequences that are not recommended" do
|
78
78
|
"π΄σ §σ ’σ ‘σ §σ ’σ Ώ GB AGB" =~ Unicode::Emoji::REGEX
|
79
79
|
assert_equal "π΄", $& # only base flag is matched
|
80
80
|
end
|
81
81
|
|
82
|
-
it "
|
82
|
+
it "matches recommended zwj sequences" do
|
83
83
|
"π€Ύπ½ββοΈ woman playing handball: medium skin tone" =~ Unicode::Emoji::REGEX
|
84
84
|
assert_equal "π€Ύπ½ββοΈ", $&
|
85
85
|
end
|
86
86
|
|
87
|
-
it "does not match valid zwj sequences
|
87
|
+
it "does not match valid zwj sequences that are not recommended" do
|
88
88
|
"π€ βπ€’ vomiting cowboy" =~ Unicode::Emoji::REGEX
|
89
89
|
assert_equal "π€ ", $&
|
90
90
|
end
|
@@ -111,7 +111,7 @@ describe Unicode::Emoji do
|
|
111
111
|
assert_nil $&
|
112
112
|
end
|
113
113
|
|
114
|
-
it "
|
114
|
+
it "matches textual singleton emoji in combination with emoji variation selector" do
|
115
115
|
"βΆ\u{FE0F} play button" =~ Unicode::Emoji::REGEX_VALID
|
116
116
|
assert_equal "βΆ\u{FE0F}", $&
|
117
117
|
end
|
@@ -121,7 +121,7 @@ describe Unicode::Emoji do
|
|
121
121
|
assert_nil $&
|
122
122
|
end
|
123
123
|
|
124
|
-
it "
|
124
|
+
it "matches modified emoji if modifier base emoji is used" do
|
125
125
|
"ππ½ person in bed: medium skin tone" =~ Unicode::Emoji::REGEX_VALID
|
126
126
|
assert_equal "ππ½", $&
|
127
127
|
end
|
@@ -131,7 +131,7 @@ describe Unicode::Emoji do
|
|
131
131
|
assert_equal "π΅", $&
|
132
132
|
end
|
133
133
|
|
134
|
-
it "
|
134
|
+
it "matches valid region flags" do
|
135
135
|
"π΅πΉ Portugal" =~ Unicode::Emoji::REGEX_VALID
|
136
136
|
assert_equal "π΅πΉ", $&
|
137
137
|
end
|
@@ -141,17 +141,17 @@ describe Unicode::Emoji do
|
|
141
141
|
assert_nil $&
|
142
142
|
end
|
143
143
|
|
144
|
-
it "
|
144
|
+
it "matches emoji keycap sequences" do
|
145
145
|
"2οΈβ£ keycap: 2" =~ Unicode::Emoji::REGEX_VALID
|
146
146
|
assert_equal "2οΈβ£", $&
|
147
147
|
end
|
148
148
|
|
149
|
-
it "
|
149
|
+
it "matches recommended tag sequences" do
|
150
150
|
"π΄σ §σ ’σ ³σ £σ ΄σ Ώ Scotland" =~ Unicode::Emoji::REGEX_VALID
|
151
151
|
assert_equal "π΄σ §σ ’σ ³σ £σ ΄σ Ώ", $&
|
152
152
|
end
|
153
153
|
|
154
|
-
it "
|
154
|
+
it "matches valid tag sequences, even though they are not recommended" do
|
155
155
|
"π΄σ §σ ’σ ‘σ §σ ’σ Ώ GB AGB" =~ Unicode::Emoji::REGEX_VALID
|
156
156
|
assert_equal "π΄σ §σ ’σ ‘σ §σ ’σ Ώ", $&
|
157
157
|
end
|
@@ -161,12 +161,12 @@ describe Unicode::Emoji do
|
|
161
161
|
assert_equal "π΄", $&
|
162
162
|
end
|
163
163
|
|
164
|
-
it "
|
164
|
+
it "matches recommended zwj sequences" do
|
165
165
|
"π€Ύπ½ββοΈ woman playing handball: medium skin tone" =~ Unicode::Emoji::REGEX_VALID
|
166
166
|
assert_equal "π€Ύπ½ββοΈ", $&
|
167
167
|
end
|
168
168
|
|
169
|
-
it "
|
169
|
+
it "matches valid zwj sequences, even though they are not recommended" do
|
170
170
|
"π€ βπ€’ vomiting cowboy" =~ Unicode::Emoji::REGEX_VALID
|
171
171
|
assert_equal "π€ βπ€’", $&
|
172
172
|
end
|
@@ -193,7 +193,7 @@ describe Unicode::Emoji do
|
|
193
193
|
assert_nil $&
|
194
194
|
end
|
195
195
|
|
196
|
-
it "
|
196
|
+
it "matches textual singleton emoji in combination with emoji variation selector" do
|
197
197
|
"βΆ\u{FE0F} play button" =~ Unicode::Emoji::REGEX
|
198
198
|
assert_equal "βΆ\u{FE0F}", $&
|
199
199
|
end
|
@@ -240,12 +240,12 @@ describe Unicode::Emoji do
|
|
240
240
|
assert_nil $&
|
241
241
|
end
|
242
242
|
|
243
|
-
it "
|
243
|
+
it "matches singleton emoji in combination with text variation selector" do
|
244
244
|
"π΄\u{FE0E} sleeping face" =~ Unicode::Emoji::REGEX_TEXT
|
245
245
|
assert_equal "π΄\u{FE0E}", $&
|
246
246
|
end
|
247
247
|
|
248
|
-
it "
|
248
|
+
it "matches textual singleton emoji" do
|
249
249
|
"βΆ play button" =~ Unicode::Emoji::REGEX_TEXT
|
250
250
|
assert_equal "βΆ", $&
|
251
251
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "[Emoji 5.0] Retrieve emoji data about Unicode codepoints. Also contains
|
14
14
|
a regex to match emoji."
|