Class: RMark::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/r_mark/handler.rb

Instance Method Summary collapse

Instance Method Details

#call(template) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/r_mark/handler.rb', line 3

def call(template)
  begin
    extend "::RMark::Parsers::#{setting.parser}".constantize
  rescue NameError
    raise ConfigurationError, 'Parser supports only :Redcarpet, :RDiscount, and :Kramdown'
  end

  parse(template.source, setting.options).inspect + '.html_safe'
end