Sha256: 21239bc770032cc346c1bb4ed4ec4983735ef9ae5911c49427c09f8df4293fab

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/common'

module Webgen::ContentProcessor

  # Processes embedded Ruby statements.
  class Erb

    # Process the Ruby statements embedded in the content of +context+.
    def call(context)
      require 'erb'
      extend(ERB::Util)

      erb = ERB.new(context.content)
      erb.filename = context.ref_node.alcn
      context.content = erb.result(binding)
      context
    rescue Exception => e
      raise Webgen::RenderError.new(e, self.class.name, context.dest_node,
                                    Webgen::Common.error_file(e), Webgen::Common.error_line(e))
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webgen-0.5.17 lib/webgen/contentprocessor/erb.rb
webgen-0.5.15 lib/webgen/contentprocessor/erb.rb
webgen-0.5.14 lib/webgen/contentprocessor/erb.rb
webgen-0.5.13 lib/webgen/contentprocessor/erb.rb
webgen-0.5.12 lib/webgen/contentprocessor/erb.rb