Class: Texterb::Handler

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

Instance Method Summary collapse

Instance Method Details

#call(template) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/texterb.rb', line 14

def call(template)
  compiled_source = erb_handler.call(template)
  if template.formats.include?(:html)
    "RedCloth.new(begin;#{compiled_source};end).to_html.html_safe"
  else
    compiled_source
  end
end

#erb_handlerObject



10
11
12
# File 'lib/texterb.rb', line 10

def erb_handler
  @erb_handler ||= ActionView::Template.registered_template_handler(:erb)
end