Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rumoji
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
rumoji
Commits
07787c4e
Commit
07787c4e
authored
Jan 10, 2017
by
Mark Wunsch
Committed by
GitHub
Jan 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #36 from myhobnob/properly-detect-multi-character-emoji
Properly detect multi-character emoji
parents
ca0dde1f
6c535b1d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
5 deletions
+20
-5
lib/rumoji/emoji.rb
+8
-0
lib/rumoji/emoji/nature.rb
+1
-1
lib/rumoji/emoji/objects.rb
+1
-1
lib/rumoji/emoji/people.rb
+1
-1
lib/rumoji/emoji/places.rb
+1
-1
lib/rumoji/emoji/symbols.rb
+1
-1
spec/rumoji_spec.rb
+7
-0
No files found.
lib/rumoji/emoji.rb
View file @
07787c4e
...
@@ -47,6 +47,14 @@ module Rumoji
...
@@ -47,6 +47,14 @@ module Rumoji
codepoints
.
size
>
1
codepoints
.
size
>
1
end
end
# Sort by reverse alphabetical order so that longer more complex emoji are
# matched in the regex before their simpler components
# e.g. :man-man-boy: needs to come before :man: in the regex or else
# :man-man-boy: will never be matched
def
<
=>
(
other
)
other
.
symbol
<=>
symbol
end
autoload
:PEOPLE
,
'rumoji/emoji/people'
autoload
:PEOPLE
,
'rumoji/emoji/people'
autoload
:NATURE
,
'rumoji/emoji/nature'
autoload
:NATURE
,
'rumoji/emoji/nature'
autoload
:OBJECTS
,
'rumoji/emoji/objects'
autoload
:OBJECTS
,
'rumoji/emoji/objects'
...
...
lib/rumoji/emoji/nature.rb
View file @
07787c4e
...
@@ -5,7 +5,7 @@ require 'set'
...
@@ -5,7 +5,7 @@ require 'set'
module
Rumoji
module
Rumoji
class
Emoji
class
Emoji
NATURE
=
Set
[
NATURE
=
S
ortedS
et
[
self
.
new
(
"
\u
{2600}"
,
[
:sunny
],
"BLACK SUN WITH RAYS"
),
self
.
new
(
"
\u
{2600}"
,
[
:sunny
],
"BLACK SUN WITH RAYS"
),
self
.
new
(
"
\u
{2614}"
,
[
:umbrella
],
"UMBRELLA WITH RAIN DROPS"
),
self
.
new
(
"
\u
{2614}"
,
[
:umbrella
],
"UMBRELLA WITH RAIN DROPS"
),
self
.
new
(
"
\u
{2601}"
,
[
:cloud
]),
self
.
new
(
"
\u
{2601}"
,
[
:cloud
]),
...
...
lib/rumoji/emoji/objects.rb
View file @
07787c4e
...
@@ -5,7 +5,7 @@ require 'set'
...
@@ -5,7 +5,7 @@ require 'set'
module
Rumoji
module
Rumoji
class
Emoji
class
Emoji
OBJECTS
=
Set
[
OBJECTS
=
S
ortedS
et
[
self
.
new
(
"
\u
{1F38D}"
,
[
:bamboo
],
"PINE DECORATION"
),
# "Japanese new year's door decoration
self
.
new
(
"
\u
{1F38D}"
,
[
:bamboo
],
"PINE DECORATION"
),
# "Japanese new year's door decoration
self
.
new
(
"
\u
{1F49D}"
,
[
:gift_heart
],
"HEART WITH RIBBON"
),
self
.
new
(
"
\u
{1F49D}"
,
[
:gift_heart
],
"HEART WITH RIBBON"
),
self
.
new
(
"
\u
{1F38E}"
,
[
:dolls
],
"JAPANESE DOLLS"
),
# "Japanese Hinamatsuri or girls' doll festival"
self
.
new
(
"
\u
{1F38E}"
,
[
:dolls
],
"JAPANESE DOLLS"
),
# "Japanese Hinamatsuri or girls' doll festival"
...
...
lib/rumoji/emoji/people.rb
View file @
07787c4e
...
@@ -5,7 +5,7 @@ require 'set'
...
@@ -5,7 +5,7 @@ require 'set'
module
Rumoji
module
Rumoji
class
Emoji
class
Emoji
PEOPLE
=
Set
[
PEOPLE
=
S
ortedS
et
[
self
.
new
(
"
\u
{1F604}"
,
[
:smile
,
:simple_smile
],
"SMILING FACE WITH OPEN MOUTH AND SMILING EYES"
),
self
.
new
(
"
\u
{1F604}"
,
[
:smile
,
:simple_smile
],
"SMILING FACE WITH OPEN MOUTH AND SMILING EYES"
),
self
.
new
(
"
\u
{1F606}"
,
[
:laughing
],
"SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES"
),
self
.
new
(
"
\u
{1F606}"
,
[
:laughing
],
"SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES"
),
self
.
new
(
"
\u
{1F60A}"
,
[
:blush
],
"SMILING FACE WITH SMILING EYES"
),
self
.
new
(
"
\u
{1F60A}"
,
[
:blush
],
"SMILING FACE WITH SMILING EYES"
),
...
...
lib/rumoji/emoji/places.rb
View file @
07787c4e
...
@@ -5,7 +5,7 @@ require 'set'
...
@@ -5,7 +5,7 @@ require 'set'
module
Rumoji
module
Rumoji
class
Emoji
class
Emoji
PLACES
=
Set
[
PLACES
=
S
ortedS
et
[
self
.
new
(
"
\u
{1f6a1}"
,
[
:aerial_tramway
]),
self
.
new
(
"
\u
{1f6a1}"
,
[
:aerial_tramway
]),
self
.
new
(
"
\u
{2708}"
,
[
:airplane
]),
self
.
new
(
"
\u
{2708}"
,
[
:airplane
]),
self
.
new
(
"
\u
{1f691}"
,
[
:ambulance
]),
self
.
new
(
"
\u
{1f691}"
,
[
:ambulance
]),
...
...
lib/rumoji/emoji/symbols.rb
View file @
07787c4e
...
@@ -5,7 +5,7 @@ require 'set'
...
@@ -5,7 +5,7 @@ require 'set'
module
Rumoji
module
Rumoji
class
Emoji
class
Emoji
SYMBOLS
=
Set
[
SYMBOLS
=
S
ortedS
et
[
self
.
new
(
"
\u
{1f4af}"
,
[
:"100"
]),
self
.
new
(
"
\u
{1f4af}"
,
[
:"100"
]),
self
.
new
(
"
\u
{1f522}"
,
[
:"1234"
]),
self
.
new
(
"
\u
{1f522}"
,
[
:"1234"
]),
self
.
new
(
"
\u
{1f170}"
,
[
:a
]),
self
.
new
(
"
\u
{1f170}"
,
[
:a
]),
...
...
spec/rumoji_spec.rb
View file @
07787c4e
...
@@ -10,6 +10,7 @@ describe Rumoji do
...
@@ -10,6 +10,7 @@ describe Rumoji do
@zero
=
"0️⃣"
@zero
=
"0️⃣"
@us
=
"🇺🇸"
@us
=
"🇺🇸"
@non_potable_water
=
"🚱"
@non_potable_water
=
"🚱"
@man_man_boy_boy
=
"👨👨👦👦"
end
end
describe
"#encode"
do
describe
"#encode"
do
...
@@ -23,6 +24,12 @@ describe Rumoji do
...
@@ -23,6 +24,12 @@ describe Rumoji do
Rumoji
.
encode
(
text
).
must_equal
text
Rumoji
.
encode
(
text
).
must_equal
text
end
end
it
"encodes man_man_boy_boy"
do
text
=
"
#{
@man_man_boy_boy
}
"
Rumoji
.
encode
(
text
).
must_equal
":man-man-boy-boy:"
Rumoji
.
encode
(
text
).
wont_equal
":man::man::boy::boy:"
end
describe
"with multiple codepoints"
do
describe
"with multiple codepoints"
do
it
"transforms a stream"
do
it
"transforms a stream"
do
Rumoji
.
encode
(
"
#{
@zero
}
"
).
must_equal
":zero:"
Rumoji
.
encode
(
"
#{
@zero
}
"
).
must_equal
":zero:"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment