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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8a2374f40fac31061e825e42b16bbed3ad4455c
4
- data.tar.gz: 567004277315d4a7a05dd7a86e07056e968e78ef
3
+ metadata.gz: 8c4eb20ad652c14682be8230ae7d0055bbf20960
4
+ data.tar.gz: 74859c59a011fc5e6464fac81851ff1e1c0f14c8
5
5
  SHA512:
6
- metadata.gz: 317e769c1426b946ff102670024dda19f8fbe0975af670a01ff79fc0e3c50571ccac503082dda8468b696dd9574ad206c39e20989f8b283993b7c3b48591c356
7
- data.tar.gz: b2608a118f51a6c11d579696b4949ceef9827ee45c93609e3816c303199246942842150e240a9f33a013c2290ee1abd8e1b82960b2dcd93ffcc28c9c8debc4f8
6
+ metadata.gz: 42556f73e4623278ef522855822711fa133fbd7a0bd4c04b3a7c4aae8976e7678f5d8ea61408346517c768b3416f8808a37d0900ea7fdabd3a3bea96c0d3fe08
7
+ data.tar.gz: 9491eebda45d972a0a11df1ce9f688f1c7c66646b09d261a6aff91549ddc5c3eb881a0bb71a8551da1a5046e074a44c993fc7479df98f6c927eaf5774691a6cd
@@ -1,6 +1,10 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 0.9.1
4
+
5
+ - Include a categorized list of recommended Emoji
6
+
3
7
  ### 0.9.0
4
8
 
5
- * Initial release (Emoji version 5.0)
9
+ - Initial release (Emoji version 5.0)
6
10
 
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 sequence names](https://github.com/janlelis/unicode-sequence_name)
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
Binary file
@@ -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.0".freeze
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
@@ -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.0
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-08 00:00:00.000000000 Z
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."