rumoji 0.1.0 → 0.2.0
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.
- data/Gemfile +2 -0
- data/README.md +5 -3
- data/Rakefile +1 -1
- data/bin/rumoji +6 -0
- data/lib/rumoji.rb +10 -215
- data/lib/rumoji/emoji.rb +57 -0
- data/lib/rumoji/emoji/nature.rb +127 -0
- data/lib/rumoji/emoji/objects.rb +265 -0
- data/lib/rumoji/emoji/people.rb +184 -0
- data/lib/rumoji/emoji/places.rb +113 -0
- data/lib/rumoji/emoji/symbols.rb +201 -0
- data/lib/rumoji/version.rb +1 -1
- data/spec/rumoji/emoji_spec.rb +80 -0
- data/spec/rumoji_spec.rb +3 -3
- metadata +15 -5
@@ -0,0 +1,201 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'rumoji/emoji'
|
4
|
+
require 'set'
|
5
|
+
|
6
|
+
module Rumoji
|
7
|
+
class Emoji
|
8
|
+
SYMBOLS = Set[
|
9
|
+
self.new("\u{1f4af}", [:"100"]),
|
10
|
+
self.new("\u{1f522}", [:"1234"]),
|
11
|
+
self.new("\u{1f170}", [:a]),
|
12
|
+
self.new("\u{1f18e}", [:ab]),
|
13
|
+
self.new("\u{1f524}", [:abc]),
|
14
|
+
self.new("\u{1f521}", [:abcd]),
|
15
|
+
self.new("\u{1f251}", [:accept]),
|
16
|
+
self.new("\u{2652}" , [:aquarius]),
|
17
|
+
self.new("\u{2648}" , [:aries]),
|
18
|
+
self.new("\u{25c0}" , [:arrow_backward]),
|
19
|
+
self.new("\u{23ec}" , [:arrow_double_down]),
|
20
|
+
self.new("\u{23eb}" , [:arrow_double_up]),
|
21
|
+
self.new("\u{2b07}" , [:arrow_down]),
|
22
|
+
self.new("\u{1f53d}", [:arrow_down_small]),
|
23
|
+
self.new("\u{25b6}" , [:arrow_forward]),
|
24
|
+
self.new("\u{2935}" , [:arrow_heading_down]),
|
25
|
+
self.new("\u{2934}" , [:arrow_heading_up]),
|
26
|
+
self.new("\u{2b05}" , [:arrow_left]),
|
27
|
+
self.new("\u{2199}" , [:arrow_lower_left]),
|
28
|
+
self.new("\u{2198}" , [:arrow_lower_right]),
|
29
|
+
self.new("\u{27a1}" , [:arrow_right]),
|
30
|
+
self.new("\u{21aa}" , [:arrow_right_hook]),
|
31
|
+
self.new("\u{2b06}" , [:arrow_up]),
|
32
|
+
self.new("\u{2195}" , [:arrow_up_down]),
|
33
|
+
self.new("\u{1f53c}", [:arrow_up_small]),
|
34
|
+
self.new("\u{2196}" , [:arrow_upper_left]),
|
35
|
+
self.new("\u{2197}" , [:arrow_upper_right]),
|
36
|
+
self.new("\u{1f503}", [:arrows_clockwise]),
|
37
|
+
self.new("\u{1f504}", [:arrows_counterclockwise]),
|
38
|
+
self.new("\u{1f171}", [:b]),
|
39
|
+
self.new("\u{1f6bc}", [:baby_symbol]),
|
40
|
+
self.new("\u{1f6c4}", [:baggage_claim]),
|
41
|
+
self.new("\u{2611}" , [:ballot_box_with_check]),
|
42
|
+
self.new("\u{203c}" , [:bangbang]),
|
43
|
+
self.new("\u{26ab}" , [:black_circle]),
|
44
|
+
self.new("\u{1f532}", [:black_square_button]),
|
45
|
+
self.new("\u{264b}" , [:cancer]),
|
46
|
+
self.new("\u{1f520}", [:capital_abcd]),
|
47
|
+
self.new("\u{2651}" , [:capricorn]),
|
48
|
+
self.new("\u{1f4b9}", [:chart]),
|
49
|
+
self.new("\u{1f6b8}", [:children_crossing]),
|
50
|
+
self.new("\u{1f3a6}", [:cinema]),
|
51
|
+
self.new("\u{1f191}", [:cl]),
|
52
|
+
self.new("\u{1f550}", [:clock1]),
|
53
|
+
self.new("\u{1f559}", [:clock10]),
|
54
|
+
self.new("\u{1f565}", [:clock1030]),
|
55
|
+
self.new("\u{1f55a}", [:clock11]),
|
56
|
+
self.new("\u{1f566}", [:clock1130]),
|
57
|
+
self.new("\u{1f55b}", [:clock12]),
|
58
|
+
self.new("\u{1f567}", [:clock1230]),
|
59
|
+
self.new("\u{1f55c}", [:clock130]),
|
60
|
+
self.new("\u{1f551}", [:clock2]),
|
61
|
+
self.new("\u{1f55d}", [:clock230]),
|
62
|
+
self.new("\u{1f552}", [:clock3]),
|
63
|
+
self.new("\u{1f55e}", [:clock330]),
|
64
|
+
self.new("\u{1f553}", [:clock4]),
|
65
|
+
self.new("\u{1f55f}", [:clock430]),
|
66
|
+
self.new("\u{1f554}", [:clock5]),
|
67
|
+
self.new("\u{1f560}", [:clock530]),
|
68
|
+
self.new("\u{1f555}", [:clock6]),
|
69
|
+
self.new("\u{1f561}", [:clock630]),
|
70
|
+
self.new("\u{1f556}", [:clock7]),
|
71
|
+
self.new("\u{1f562}", [:clock730]),
|
72
|
+
self.new("\u{1f557}", [:clock8]),
|
73
|
+
self.new("\u{1f563}", [:clock830]),
|
74
|
+
self.new("\u{1f558}", [:clock9]),
|
75
|
+
self.new("\u{1f564}", [:clock930]),
|
76
|
+
self.new("\u{3297}" , [:congratulations]),
|
77
|
+
self.new("\u{1f192}", [:cool]),
|
78
|
+
self.new("\u{00a9}" , [:copyright]),
|
79
|
+
self.new("\u{27b0}" , [:curly_loop]),
|
80
|
+
self.new("\u{1f4b1}", [:currency_exchange]),
|
81
|
+
self.new("\u{1f6c3}", [:customs]),
|
82
|
+
self.new("\u{1f4a0}", [:diamond_shape_with_a_dot_inside]),
|
83
|
+
self.new("\u{1f6af}", [:do_not_litter]),
|
84
|
+
self.new("\u{0038}" , [:eight]),
|
85
|
+
self.new("\u{2734}" , [:eight_pointed_black_star]),
|
86
|
+
self.new("\u{2733}" , [:eight_spoked_asterisk]),
|
87
|
+
self.new("\u{1f51a}", [:end]),
|
88
|
+
self.new("\u{23e9}" , [:fast_forward]),
|
89
|
+
self.new("\u{0035}" , [:five]),
|
90
|
+
self.new("\u{0034}" , [:four]),
|
91
|
+
self.new("\u{1f193}", [:free]),
|
92
|
+
self.new("\u{264a}" , [:gemini]),
|
93
|
+
self.new("\u{0023}" , [:hash]),
|
94
|
+
self.new("\u{1f49f}", [:heart_decoration]),
|
95
|
+
self.new("\u{2714}" , [:heavy_check_mark]),
|
96
|
+
self.new("\u{2797}" , [:heavy_division_sign]),
|
97
|
+
self.new("\u{1f4b2}", [:heavy_dollar_sign]),
|
98
|
+
self.new("\u{2796}" , [:heavy_minus_sign]),
|
99
|
+
self.new("\u{2716}" , [:heavy_multiplication_x]),
|
100
|
+
self.new("\u{2795}" , [:heavy_plus_sign]),
|
101
|
+
self.new("\u{1f194}", [:id]),
|
102
|
+
self.new("\u{1f250}", [:ideograph_advantage]),
|
103
|
+
self.new("\u{2139}" , [:information_source]),
|
104
|
+
self.new("\u{2049}" , [:interrobang]),
|
105
|
+
self.new("\u{1f51f}", [:keycap_ten]),
|
106
|
+
self.new("\u{1f201}", [:koko]),
|
107
|
+
self.new("\u{1f535}", [:large_blue_circle]),
|
108
|
+
self.new("\u{1f537}", [:large_blue_diamond]),
|
109
|
+
self.new("\u{1f536}", [:large_orange_diamond]),
|
110
|
+
self.new("\u{1f6c5}", [:left_luggage]),
|
111
|
+
self.new("\u{2194}" , [:left_right_arrow]),
|
112
|
+
self.new("\u{21a9}" , [:leftwards_arrow_with_hook]),
|
113
|
+
self.new("\u{264c}" , [:leo]),
|
114
|
+
self.new("\u{264e}" , [:libra]),
|
115
|
+
self.new("\u{1f517}", [:link]),
|
116
|
+
self.new("\u{24c2}" , [:m]),
|
117
|
+
self.new("\u{1f6b9}", [:mens]),
|
118
|
+
self.new("\u{1f687}", [:metro]),
|
119
|
+
self.new("\u{1f4f4}", [:mobile_phone_off]),
|
120
|
+
self.new("\u{274e}" , [:negative_squared_cross_mark]),
|
121
|
+
self.new("\u{1f195}", [:new]),
|
122
|
+
self.new("\u{1f196}", [:ng]),
|
123
|
+
self.new("\u{0039}" , [:nine]),
|
124
|
+
self.new("\u{1f6b3}", [:no_bicycles]),
|
125
|
+
self.new("\u{26d4}" , [:no_entry]),
|
126
|
+
self.new("\u{1f6ab}", [:no_entry_sign]),
|
127
|
+
self.new("\u{1f4f5}", [:no_mobile_phones]),
|
128
|
+
self.new("\u{1f6b7}", [:no_pedestrians]),
|
129
|
+
self.new("\u{1f6ad}", [:no_smoking]),
|
130
|
+
self.new("\u{1f6b1}", [:"non-potable_water"]),
|
131
|
+
self.new("\u{2b55}" , [:o]),
|
132
|
+
self.new("\u{1f17e}", [:o2]),
|
133
|
+
self.new("\u{1f197}", [:ok]),
|
134
|
+
self.new("\u{1f51b}", [:on]),
|
135
|
+
self.new("\u{0031}" , [:one]),
|
136
|
+
self.new("\u{26ce}" , [:ophiuchus]),
|
137
|
+
self.new("\u{1f17f}", [:parking]),
|
138
|
+
self.new("\u{303d}" , [:part_alternation_mark]),
|
139
|
+
self.new("\u{1f6c2}", [:passport_control]),
|
140
|
+
self.new("\u{2653}" , [:pisces]),
|
141
|
+
self.new("\u{1f6b0}", [:potable_water]),
|
142
|
+
self.new("\u{1f6ae}", [:put_litter_in_its_place]),
|
143
|
+
self.new("\u{1f518}", [:radio_button]),
|
144
|
+
self.new("\u{267b}" , [:recycle]),
|
145
|
+
self.new("\u{1f534}", [:red_circle]),
|
146
|
+
self.new("\u{00ae}" , [:registered]),
|
147
|
+
self.new("\u{1f501}", [:repeat]),
|
148
|
+
self.new("\u{1f502}", [:repeat_one]),
|
149
|
+
self.new("\u{1f6bb}", [:restroom]),
|
150
|
+
self.new("\u{23ea}" , [:rewind]),
|
151
|
+
self.new("\u{1f202}", [:sa]),
|
152
|
+
self.new("\u{2650}" , [:sagittarius]),
|
153
|
+
self.new("\u{264f}" , [:scorpius]),
|
154
|
+
self.new("\u{3299}" , [:secret]),
|
155
|
+
self.new("\u{0037}" , [:seven]),
|
156
|
+
self.new("\u{1f4f6}", [:signal_strength]),
|
157
|
+
self.new("\u{0036}" , [:six]),
|
158
|
+
self.new("\u{1f52f}", [:six_pointed_star]),
|
159
|
+
self.new("\u{1f539}", [:small_blue_diamond]),
|
160
|
+
self.new("\u{1f538}", [:small_orange_diamond]),
|
161
|
+
self.new("\u{1f53a}", [:small_red_triangle]),
|
162
|
+
self.new("\u{1f53b}", [:small_red_triangle_down]),
|
163
|
+
self.new("\u{1f51c}", [:soon]),
|
164
|
+
self.new("\u{1f198}", [:sos]),
|
165
|
+
self.new("\u{1f523}", [:symbols]),
|
166
|
+
self.new("\u{2649}" , [:taurus]),
|
167
|
+
self.new("\u{0033}" , [:three]),
|
168
|
+
self.new("\u{2122}" , [:tm]),
|
169
|
+
self.new("\u{1f51d}", [:top]),
|
170
|
+
self.new("\u{1f531}", [:trident]),
|
171
|
+
self.new("\u{1f500}", [:twisted_rightwards_arrows]),
|
172
|
+
self.new("\u{0032}" , [:two]),
|
173
|
+
self.new("\u{1f239}", [:u5272]),
|
174
|
+
self.new("\u{1f234}", [:u5408]),
|
175
|
+
self.new("\u{1f23a}", [:u55b6]),
|
176
|
+
self.new("\u{1f22f}", [:u6307]),
|
177
|
+
self.new("\u{1f237}", [:u6708]),
|
178
|
+
self.new("\u{1f236}", [:u6709]),
|
179
|
+
self.new("\u{1f235}", [:u6e80]),
|
180
|
+
self.new("\u{1f21a}", [:u7121]),
|
181
|
+
self.new("\u{1f238}", [:u7533]),
|
182
|
+
self.new("\u{1f232}", [:u7981]),
|
183
|
+
self.new("\u{1f233}", [:u7a7a]),
|
184
|
+
self.new("\u{1f51e}", [:underage]),
|
185
|
+
self.new("\u{1f199}", [:up]),
|
186
|
+
self.new("\u{1f4f3}", [:vibration_mode]),
|
187
|
+
self.new("\u{264d}" , [:virgo]),
|
188
|
+
self.new("\u{1f19a}", [:vs]),
|
189
|
+
self.new("\u{3030}" , [:wavy_dash]),
|
190
|
+
self.new("\u{1f6be}", [:wc]),
|
191
|
+
self.new("\u{267f}" , [:wheelchair]),
|
192
|
+
self.new("\u{2705}" , [:white_check_mark]),
|
193
|
+
self.new("\u{26aa}" , [:white_circle]),
|
194
|
+
self.new("\u{1f4ae}", [:white_flower]),
|
195
|
+
self.new("\u{1f533}", [:white_square_button]),
|
196
|
+
self.new("\u{1f6ba}", [:womens]),
|
197
|
+
self.new("\u{274c}" , [:x]),
|
198
|
+
self.new("\u{0030}" , [:zero])
|
199
|
+
]
|
200
|
+
end
|
201
|
+
end
|
data/lib/rumoji/version.rb
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'rumoji'
|
3
|
+
require 'minitest/spec'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
|
6
|
+
describe Rumoji::Emoji do
|
7
|
+
let(:symbols) { [:hankey, :poop, :shit] }
|
8
|
+
let(:name) { "PILE OF POO" }
|
9
|
+
let(:poo_string) { "\u{1F4A9}" }
|
10
|
+
|
11
|
+
subject do
|
12
|
+
Rumoji::Emoji.new(poo_string, symbols, name)
|
13
|
+
end
|
14
|
+
|
15
|
+
it("has a name") { subject.name.must_equal name }
|
16
|
+
it("has a cheat sheet code") { symbols.must_include subject.code[1...-1].intern }
|
17
|
+
it("can test if it includes a cheat sheet code") { symbols.all?{|symbol| subject.include?(symbol) }.must_equal true }
|
18
|
+
it("converts to the emoji string") { subject.to_s.must_equal poo_string }
|
19
|
+
it("converts to a hex code") { subject.hex.must_equal "1F4A9" }
|
20
|
+
|
21
|
+
describe "inferring the name" do
|
22
|
+
let (:symbol) { :person_with_pouting_face }
|
23
|
+
subject do
|
24
|
+
Rumoji::Emoji.new("\u{1F64E}", symbol)
|
25
|
+
end
|
26
|
+
|
27
|
+
it("infers the name from the symbol") { subject.name.must_equal "PERSON WITH POUTING FACE" }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "with multiple codepoints" do
|
31
|
+
# From the Unicode 6.2.0 standard:
|
32
|
+
# The regional indicator symbols in the range
|
33
|
+
# U+1F1E6..U+1F1FF can be used in pairs to represent an ISO 3166 region code.
|
34
|
+
# This mechanism is not intended to supplant actual ISO 3166 region codes,
|
35
|
+
# which simply use Latin letters in the ASCII range; instead the main purpose
|
36
|
+
# of such pairs is to provide unambiguous roundtrip mappings to certain
|
37
|
+
# characters used in the emoji core sets. The representative glyph for
|
38
|
+
# region indicator symbols is simply a dotted box containing a letter. The
|
39
|
+
# Unicode Standard does not prescribe how the pairs of region indicator
|
40
|
+
# symbols should be rendered. In emoji contexts, where text is displayed
|
41
|
+
# as it would be on a Japanese mobile phone, a pair may be displayed using
|
42
|
+
# the glyph for a flag, as appropriate, but in other contexts the pair
|
43
|
+
# could be rendered differently
|
44
|
+
#
|
45
|
+
# http://www.unicode.org/versions/Unicode6.2.0/
|
46
|
+
let(:symbol) { :us }
|
47
|
+
let(:name) { "REGIONAL INDICATOR SYMBOL LETTERS US" }
|
48
|
+
let(:us_string) { "\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8" }
|
49
|
+
|
50
|
+
subject do
|
51
|
+
Rumoji::Emoji.new(us_string, symbol, name)
|
52
|
+
end
|
53
|
+
|
54
|
+
it("has one symbol, representing the code") { subject.symbol.must_equal symbol }
|
55
|
+
it("has one cheat sheet code") { subject.code[1...-1].intern.must_equal symbol }
|
56
|
+
it("includes the symbol") { subject.must_include symbol }
|
57
|
+
it("transforms to the correct string") { subject.to_s.must_equal us_string }
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "factory methods" do
|
61
|
+
subject { Rumoji::Emoji }
|
62
|
+
let(:smile_str) { "\u{1F604}" }
|
63
|
+
let(:smile_sym) { :smile }
|
64
|
+
|
65
|
+
it "finds an emoji from cheat sheet code" do
|
66
|
+
subject.find(smile_sym).to_s.must_equal smile_str
|
67
|
+
end
|
68
|
+
|
69
|
+
it "finds an emoji from a string" do
|
70
|
+
subject.find_by_string(smile_str).symbol.must_equal smile_sym
|
71
|
+
end
|
72
|
+
|
73
|
+
it "finds an emoji from a codepoint" do
|
74
|
+
smile_str.codepoints.map do |point|
|
75
|
+
subject.find_by_codepoint(point).symbol.must_equal smile_sym
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/spec/rumoji_spec.rb
CHANGED
@@ -25,14 +25,14 @@ describe Rumoji do
|
|
25
25
|
describe "#encode_io" do
|
26
26
|
it "reads emoji from one stream and outputs a stream of cheat-sheet codes" do
|
27
27
|
io = StringIO.new("#{@smile}")
|
28
|
-
Rumoji.encode_io(io).
|
28
|
+
Rumoji.encode_io(io).string.must_equal ":smile:"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#decode_io" do
|
33
33
|
it "reads a cheat-sheet code from one stream and outputs a stream of emoji" do
|
34
34
|
io = StringIO.new(":poop:")
|
35
|
-
Rumoji.decode_io(io).
|
35
|
+
Rumoji.decode_io(io).string.must_equal @poop
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Transcode emoji utf-8 characters into emoji-cheat-sheet form
|
15
15
|
email:
|
16
16
|
- mark@markwunsch.com
|
17
|
-
executables:
|
17
|
+
executables:
|
18
|
+
- rumoji
|
18
19
|
extensions: []
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
@@ -23,9 +24,17 @@ files:
|
|
23
24
|
- LICENSE.txt
|
24
25
|
- README.md
|
25
26
|
- Rakefile
|
27
|
+
- bin/rumoji
|
26
28
|
- lib/rumoji.rb
|
29
|
+
- lib/rumoji/emoji.rb
|
30
|
+
- lib/rumoji/emoji/nature.rb
|
31
|
+
- lib/rumoji/emoji/objects.rb
|
32
|
+
- lib/rumoji/emoji/people.rb
|
33
|
+
- lib/rumoji/emoji/places.rb
|
34
|
+
- lib/rumoji/emoji/symbols.rb
|
27
35
|
- lib/rumoji/version.rb
|
28
36
|
- rumoji.gemspec
|
37
|
+
- spec/rumoji/emoji_spec.rb
|
29
38
|
- spec/rumoji_spec.rb
|
30
39
|
homepage: ''
|
31
40
|
licenses: []
|
@@ -41,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
50
|
version: '0'
|
42
51
|
segments:
|
43
52
|
- 0
|
44
|
-
hash:
|
53
|
+
hash: -2903541076251608095
|
45
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
55
|
none: false
|
47
56
|
requirements:
|
@@ -50,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
59
|
version: '0'
|
51
60
|
segments:
|
52
61
|
- 0
|
53
|
-
hash:
|
62
|
+
hash: -2903541076251608095
|
54
63
|
requirements: []
|
55
64
|
rubyforge_project:
|
56
65
|
rubygems_version: 1.8.23
|
@@ -58,4 +67,5 @@ signing_key:
|
|
58
67
|
specification_version: 3
|
59
68
|
summary: Transcode emoji utf-8 characters into emoji-cheat-sheet form
|
60
69
|
test_files:
|
70
|
+
- spec/rumoji/emoji_spec.rb
|
61
71
|
- spec/rumoji_spec.rb
|