unicode-emoji 0.9.0 โ 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +20 -1
- data/data/emoji.marshal.gz +0 -0
- data/lib/unicode/emoji.rb +14 -0
- data/lib/unicode/emoji/constants.rb +1 -1
- data/spec/unicode_emoji_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c4eb20ad652c14682be8230ae7d0055bbf20960
|
4
|
+
data.tar.gz: 74859c59a011fc5e6464fac81851ff1e1c0f14c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42556f73e4623278ef522855822711fa133fbd7a0bd4c04b3a7c4aae8976e7678f5d8ea61408346517c768b3416f8808a37d0900ea7fdabd3a3bea96c0d3fe08
|
7
|
+
data.tar.gz: 9491eebda45d972a0a11df1ce9f688f1c7c66646b09d261a6aff91549ddc5c3eb881a0bb71a8551da1a5046e074a44c993fc7479df98f6c927eaf5774691a6cd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
A small Ruby library which provides Unicode Emoji data and regexes.
|
4
4
|
|
5
|
+
Also includes a categorized list of recommended Emoji.
|
6
|
+
|
5
7
|
Emoji version: **5.0**
|
6
8
|
|
7
9
|
Supported Rubies: **2.4**, **2.3**, **2.2**, **2.1**
|
@@ -54,12 +56,29 @@ Regex | Description | Example Matches | Example Non-Matc
|
|
54
56
|
`Unicode::Emoji::REGEX_TEXT` | Matches only textual singleton Emoji (except for singleton components, like digit 1) | `๐ด๏ธ`, `โถ` | `๐ด`, `โถ๏ธ`, `๐ป`, `๐๐ฝ`, `๐ต๐น`, `๐ต๐ต`,`2๏ธโฃ`, `๐ด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ`, `๐ด๓ ง๓ ข๓ ก๓ ง๓ ข๓ ฟ`, `๐คพ๐ฝโโ๏ธ`, `๐ค โ๐คข`
|
55
57
|
`Unicode::Emoji::REGEX_ANY` | Matches any Emoji-related codepoint (but no variation selectors or tags) | `๐ด`, `โถ`, `๐ป`, `๐`, `๐ฝ`, `๐ต`, `๐น`, `2`, `๐ด`, `๐คพ`, `โ`, `๐ค `, `๐คข` | -
|
56
58
|
|
59
|
+
## List
|
60
|
+
|
61
|
+
Use `Unicode::Emoji::LIST` or the list method to get a grouped (and ordered) list of Emoji:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
Unicode::Emoji.list.keys
|
65
|
+
# => ["Smileys & People", "Animals & Nature", "Food & Drink", "Travel & Places", "Activities", "Objects", "Symbols", "Flags"]
|
66
|
+
|
67
|
+
Unicode::Emoji.list("Food & Drink").keys
|
68
|
+
# => ["food-fruit", "food-vegetable", "food-prepared", "food-asian", "food-sweet", "drink", "dishware"]
|
69
|
+
|
70
|
+
Unicode::Emoji.list("Food & Drink", "food-asian")
|
71
|
+
=> ["๐ฑ", "๐", "๐", "๐", "๐", "๐", "๐", "๐ ", "๐ข", "๐ฃ", "๐ค", "๐ฅ", "๐ก", "\u{1F95F}", "\u{1F960}", "\u{1F961}"]
|
72
|
+
```
|
73
|
+
|
74
|
+
A markdown file with all recommended emoji can be found [in this gist](https://gist.github.com/janlelis/72f9be1f0ecca07372c64cf13894b801).
|
57
75
|
|
58
76
|
## Also See
|
59
77
|
|
60
78
|
- [Unicodeยฎ Technical Standard #51](http://www.unicode.org/reports/tr51/proposed.html)
|
61
79
|
- [Emoji data](http://unicode.org/Public/emoji/5.0/)
|
62
|
-
- [Emoji
|
80
|
+
- [Emoji categories](http://unicode.org/emoji/charts/emoji-ordering.html)
|
81
|
+
- Ruby gem which displays [Emoji sequence names](https://github.com/janlelis/unicode-sequence_name)
|
63
82
|
- Part of [unicode-x](https://github.com/janlelis/unicode-x)
|
64
83
|
|
65
84
|
## MIT
|
data/data/emoji.marshal.gz
CHANGED
Binary file
|
data/lib/unicode/emoji.rb
CHANGED
@@ -31,6 +31,8 @@ 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.each{ |_, sub_list| sub_list.freeze }
|
35
|
+
|
34
36
|
pack = ->(ord){ Regexp.escape(Array(ord).pack("U*")) }
|
35
37
|
join = -> (*strings){ "(?:" + strings.join("|") + ")" }
|
36
38
|
pack_and_join = ->(ords){ join[*ords.map{ |ord| pack[ord] }] }
|
@@ -127,6 +129,18 @@ module Unicode
|
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
132
|
+
def self.list(key = nil, sub_key = nil)
|
133
|
+
if key
|
134
|
+
if sub_key
|
135
|
+
LIST[key][sub_key]
|
136
|
+
else
|
137
|
+
LIST[key]
|
138
|
+
end
|
139
|
+
else
|
140
|
+
LIST
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
130
144
|
def self.get_codepoint_value(char)
|
131
145
|
ord = nil
|
132
146
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Unicode
|
4
4
|
module Emoji
|
5
|
-
VERSION = "0.9.
|
5
|
+
VERSION = "0.9.1".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
@@ -292,4 +292,18 @@ describe Unicode::Emoji do
|
|
292
292
|
assert_equal ["1", "๐ด", "๐ต", "๐พ", "๐ด"], matches
|
293
293
|
end
|
294
294
|
end
|
295
|
+
|
296
|
+
describe ".list" do
|
297
|
+
it "returns a grouped list of emoji" do
|
298
|
+
assert_includes Unicode::Emoji.list.keys, "Smileys & People"
|
299
|
+
end
|
300
|
+
|
301
|
+
it "sub-groups the list of emoji" do
|
302
|
+
assert_includes Unicode::Emoji.list("Smileys & People").keys, "face-positive"
|
303
|
+
end
|
304
|
+
|
305
|
+
it "has emoji in sub-groups" do
|
306
|
+
assert_includes Unicode::Emoji.list("Smileys & People", "face-positive"), "๐"
|
307
|
+
end
|
308
|
+
end
|
295
309
|
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.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-10 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."
|