Class Nanoc::Context
In: lib/nanoc/base/context.rb
Parent: Object

Provides a context and a binding for use in filters such as the ERB and Haml ones.

Methods

get_binding   new  

Public Class methods

Creates a new context based off the contents of the hash.

Each pair in the hash will be converted to an instance variable and an instance method. For example, passing the hash `{ :foo => ‘bar’ }` will cause `@foo` to have the value `"bar"`, and the instance method `foo` to return the same value `"bar"`.

@param [Hash] hash A list of key-value pairs to make available

@example Defining a context and accessing values

    context = Nanoc::Context.new(
      :name     => 'Max Payne',
      :location => 'in a cheap motel'
    )
    context.instance_eval do
      "I am #{name} and I am hiding #{@location}."
    end
    # => "I am Max Payne and I am hiding in a cheap motel."

Public Instance methods

Returns a binding for this instance.

@return [Binding] A binding for this instance

[Validate]