Class: Webgen::ContentProcessor::Erb
- Inherits:
-
Object
- Object
- Webgen::ContentProcessor::Erb
- Includes:
- WebsiteAccess
- Defined in:
- lib/webgen/contentprocessor/erb.rb
Overview
Processes embedded Ruby statements.
Instance Method Summary collapse
-
#call(context) ⇒ Object
Process the Ruby statements embedded in the content of
context
.
Methods included from WebsiteAccess
Instance Method Details
#call(context) ⇒ Object
Process the Ruby statements embedded in the content of context
.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/webgen/contentprocessor/erb.rb', line 11 def call(context) require 'erb' node = context.content_node ref_node = context.ref_node dest_node = context.dest_node erb = ERB.new(context.content) erb.filename = context.ref_node.absolute_lcn context.content = erb.result(binding) context rescue Exception => e raise RuntimeError, "Erb processing failed in <#{context.ref_node.absolute_lcn}>: #{e.}", e.backtrace end |