Commit b36d4ec2 by Mark Wunsch

Make emoji code pattern more permissive (to allow for 👍)

parent d51e7db9
...@@ -15,7 +15,7 @@ module Rumoji ...@@ -15,7 +15,7 @@ module Rumoji
end end
def decode(str) def decode(str)
str.gsub(/:(\w+):/) {|sym| Emoji.find($1.intern).to_s } str.gsub(/:(\S?\w+):/) {|sym| Emoji.find($1.intern).to_s }
end end
def encode_io(readable, writeable=StringIO.new("")) def encode_io(readable, writeable=StringIO.new(""))
...@@ -29,13 +29,9 @@ module Rumoji ...@@ -29,13 +29,9 @@ module Rumoji
def decode_io(readable, writeable=StringIO.new("")) def decode_io(readable, writeable=StringIO.new(""))
readable.each_line do |line| readable.each_line do |line|
writeable.write line.gsub(/:(\w+):/) {|sym| Emoji.find($1.intern).to_s } writeable.write decode(line)
end end
writeable writeable
end end
def codepoint_as_hex(codepoint)
codepoint.to_s(16).upcase
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment