Parent

Methods

Class Index [+]

Quicksearch

Webgen::Page::Block

A single block within a Page object. The content of the block can be rendered using the # method.

Attributes

name[R]

The name of the block.

content[R]

The content of the block.

options[R]

The options set specifically for this block.

Public Class Methods

new(name, content, options) click to toggle source

Create a new block with the name name and the given content and options.

    # File lib/webgen/page.rb, line 24
24:       def initialize(name, content, options)
25:         @name, @content, @options = name, content, options
26:       end

Public Instance Methods

render(context) click to toggle source

Render the block using the provided context object.

The context object needs to respond to #[] and #[]= (e.g. a Hash is a valid context object) and the key :processors needs to contain a Hash which maps processor names to processor objects that respond to #.

Uses the content processors specified in the pipeline key of the options attribute to do the actual rendering.

Returns the given context with the rendered content.

    # File lib/webgen/page.rb, line 38
38:       def render(context)
39:         context[:content] = @content.dup
40:         context[:block] = self
41:         @options['pipeline'].to_s.split(/,/).each do |processor|
42:           raise "No such content processor available: #{processor}" unless context[:processors].has_key?(processor)
43:           context[:processors][processor].call(context)
44:         end
45:         context
46:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.