Class: Tolaria::MarkdownRendererProxy

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TextHelper
Defined in:
lib/tolaria/markdown.rb

Overview

Contains a workflow for rendering Markdown. If no renderer has been configured, defers to simple_format.

Instance Method Summary collapse

Instance Method Details

#render(document) ⇒ Object

Calls the configured Markdown renderer, if none exists then uses simple_format to return more than nothing.



11
12
13
14
15
16
17
18
# File 'lib/tolaria/markdown.rb', line 11

def render(document)
  if Tolaria.config.markdown_renderer.nil?
    return simple_format(document)
  else
    @markdown_renderer ||= Tolaria.config.markdown_renderer.constantize
    return @markdown_renderer.render(document)
  end
end