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
9178177e
Commit
9178177e
authored
Oct 31, 2012
by
Mark Wunsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better variable names
parent
7dbea734
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
lib/rumoji.rb
+10
-10
No files found.
lib/rumoji.rb
View file @
9178177e
...
...
@@ -21,25 +21,25 @@ module Rumoji
duplicate
end
def
encode_io
(
input
,
output
=
StringIO
.
new
(
""
))
input
.
each_codepoint
do
|
codepoint
|
def
encode_io
(
readable
,
writeable
=
StringIO
.
new
(
""
))
readable
.
each_codepoint
do
|
codepoint
|
emoji
=
codepoint
.
to_s
(
16
).
upcase
emoji_or_character
=
EMOJI_NAME_TO_CODEPOINT
.
has_value?
(
emoji
)
?
":
#{
EMOJI_NAME_TO_CODEPOINT
.
key
(
emoji
)
}
:"
:
[
codepoint
].
pack
(
"U"
)
output
.
write
emoji_or_character
writeable
.
write
emoji_or_character
end
output
.
rewind
output
writeable
.
rewind
writeable
end
def
decode_io
(
input
,
output
=
StringIO
.
new
(
""
))
input
.
each
do
|
word
|
def
decode_io
(
readable
,
writeable
=
StringIO
.
new
(
""
))
readable
.
each
do
|
word
|
EMOJI_NAME_TO_CODEPOINT
.
each_pair
do
|
key
,
value
|
word
.
gsub!
(
":
#{
key
}
:"
,
[
value
.
to_i
(
16
)].
pack
(
"U"
))
end
output
.
write
(
word
)
writeable
.
write
(
word
)
end
output
.
rewind
output
writeable
.
rewind
writeable
end
EMOJI_NAME_TO_CODEPOINT
=
{
...
...
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