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
a6896619
Commit
a6896619
authored
Nov 06, 2013
by
Mark Wunsch
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8 from mirego/fix/regex-dash
Make decode regex work with codes that have dashes in them
parents
c3b98d3d
45ee9867
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
lib/rumoji.rb
+1
-1
spec/rumoji_spec.rb
+5
-0
No files found.
lib/rumoji.rb
View file @
a6896619
...
...
@@ -14,7 +14,7 @@ module Rumoji
# Transform a cheat-sheet code into an Emoji
def
decode
(
str
)
str
.
gsub
(
/:(\S?
\w
+):/
)
{
|
sym
|
Emoji
.
find
(
$1
.
intern
).
to_s
}
str
.
gsub
(
/:(\S?
[\w-]
+):/
)
{
|
sym
|
Emoji
.
find
(
$1
.
intern
).
to_s
}
end
def
encode_io
(
readable
,
writeable
=
StringIO
.
new
(
""
))
...
...
spec/rumoji_spec.rb
View file @
a6896619
...
...
@@ -9,6 +9,7 @@ describe Rumoji do
@smile
=
"😄"
@zero
=
"0⃣"
@us
=
"🇺🇸"
@non_potable_water
=
"🚱"
end
describe
"#encode"
do
...
...
@@ -22,6 +23,10 @@ describe Rumoji do
it
"transforms a cheat-sheet code into an emoji"
do
Rumoji
.
decode
(
":poop:"
).
must_equal
@poop
end
it
"transforms a cheat-sheet code with a dash into an emoji"
do
Rumoji
.
decode
(
":non-potable_water:"
).
must_equal
@non_potable_water
end
end
describe
"#encode_io"
do
...
...
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