Class: ActionMarkdown::Content

Inherits:
Object
  • Object
show all
Includes:
Rendering, Serialization, ActiveModel::Conversion
Defined in:
lib/action_markdown/content.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Content

Returns a new instance of Content.



5
6
7
# File 'lib/action_markdown/content.rb', line 5

def initialize(body)
  @body = body
end

Instance Method Details

#to_htmlObject



13
14
15
# File 'lib/action_markdown/content.rb', line 13

def to_html
  markdown_renderer.render(body)
end

#to_markdownObject



9
10
11
# File 'lib/action_markdown/content.rb', line 9

def to_markdown
  body
end

#to_sObject



17
18
19
# File 'lib/action_markdown/content.rb', line 17

def to_s
  render partial: to_partial_path, layout: false, locals: { content: self }
end