Class: RubyEmoji::Parser
- Inherits:
-
Object
- Object
- RubyEmoji::Parser
- Defined in:
- lib/ruby_emoji/parser.rb
Overview
The Parser to parse a string to an emoji string
Instance Method Summary collapse
-
#initialize(string) ⇒ Parser
constructor
Initialize it with the string you want to convert.
-
#parse ⇒ Object
Returns the converted string.
Constructor Details
#initialize(string) ⇒ Parser
Initialize it with the string you want to convert
6 7 8 |
# File 'lib/ruby_emoji/parser.rb', line 6 def initialize(string) @string = string end |
Instance Method Details
#parse ⇒ Object
Returns the converted string
11 12 13 14 15 16 17 |
# 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 |