Parent

Methods

Class Index [+]

Quicksearch

Webgen::ContentProcessor::Erubis

Processes embedded Ruby statements with the erubis library.

Public Instance Methods

call(context) click to toggle source

Process the Ruby statements embedded in the content of context.

    # File lib/webgen/contentprocessor/erubis.rb, line 11
11:     def call(context)
12:       require 'erubis'
13:       # including Erubis because of problem with resolving Erubis::XmlHelper et al
14:       self.class.class_eval "include ::Erubis"
15: 
16:       options = context.website.config['contentprocessor.erubis.options']
17:       if context[:block]
18:         use_pi = context[:block].options['erubis_use_pi']
19:         context[:block].options.select {|k,v| k =~ /^erubis_/}.
20:           each {|k,v| options[k.sub(/^erubis_/, '').to_sym] = v }
21:       end
22:       erubis = if (!use_pi.nil? && use_pi) || (use_pi.nil? && context.website.config['contentprocessor.erubis.use_pi'])
23:                     ::Erubis::PI::Eruby.new(context.content, options)
24:                   else
25:                     ::Erubis::Eruby.new(context.content, options)
26:                   end
27:       erubis.filename = context.ref_node.alcn
28:       context.content = erubis.result(binding)
29:       context
30:     rescue LoadError
31:       raise Webgen::LoadError.new('erubis', self.class.name, context.dest_node, 'erubis')
32:     rescue Exception => e
33:       raise Webgen::RenderError.new(e, self.class.name, context.dest_node,
34:                                     Webgen::Common.error_file(e), Webgen::Common.error_line(e))
35:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.