class RubyEmoji::Parser

The Parser to parse a string to an emoji string

Public Class Methods

new(string) click to toggle source

Initialize it with the string you want to convert

# File lib/ruby_emoji/parser.rb, line 6
def initialize(string)
  @string = string
end

Public Instance Methods

parse() click to toggle source

Returns the converted string

# File lib/ruby_emoji/parser.rb, line 11
def parse
  parts = @string.split(" ")
  results = parts.map do |part|
    RubyEmoji::EMOJI_LIST[part] || part
  end
  results.join(" ")
end