Class: Middleman::Emojifire::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/middleman-emojifire/converter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Converter

Returns a new instance of Converter.



11
12
13
# File 'lib/middleman-emojifire/converter.rb', line 11

def initialize(content)
  @content = ::Middleman::Emojifire::Content.new(content)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/middleman-emojifire/converter.rb', line 7

def content
  @content
end

Instance Method Details

#convertObject



15
16
17
18
19
20
21
# File 'lib/middleman-emojifire/converter.rb', line 15

def convert
  if content.include_body?
    content.body_only { |body| emojify(body) }
  else
    emojify(content.to_s)
  end
end