module Webgen::ContentProcessor::Erb

Processes embedded Ruby statements.

Public Class Methods

call(context) click to toggle source

Process the Ruby statements embedded in the content of context.

   # File lib/webgen/content_processor/erb.rb
14 def self.call(context)
15   erb = if RUBY_VERSION < '2.6'
16           ERB.new(context.content, nil, context.website.config['content_processor.erb.trim_mode'] || '')
17         else
18           ERB.new(context.content, trim_mode: context.website.config['content_processor.erb.trim_mode'])
19         end
20   erb.filename = context.ref_node.alcn
21   context.content = erb.result(binding)
22   context
23 end