module EmojifiRb

Constants

EMOJI_INDEX
VERSION

Public Class Methods

decode(input) click to toggle source
# File lib/emojifi_rb.rb, line 13
def self.decode input
  input.codepoints
  .map { |c| EMOJI_INDEX.index c }
  .pack("U*").force_encoding("utf-8")
end
encode(input) click to toggle source
# File lib/emojifi_rb.rb, line 6
def self.encode input
  input.bytes
  .map { |x| EMOJI_INDEX.fetch x }
  .map { |x| [x].pack "U" }
  .join
end