Class: Nanoc3::Extra::Context
Nanoc3::Extra::Context provides a context and a Binding for use in various filters, such as the ERB and Haml one.
Constructor Summary
public
initialize(hash)
Creates a new context based off the contents of the hash. Each pair in the hash will be converted to an instance variable. For example, passing the hash { :foo => ‘bar’ } will cause @foo to have the value "bar".
[View source]
12 13 14 15 16 |
# File 'lib/nanoc3/extra/context.rb', line 12 def initialize(hash) hash.each_pair do |key, value| instance_variable_set('@' + key.to_s, value) end end |
Public Visibility
Public Instance Method Summary
| #get_binding |
Returns a binding for this context. |
|---|
Public Instance Method Details
get_binding
public
get_binding
Returns a binding for this context.
[View source]
19 20 21 |
# File 'lib/nanoc3/extra/context.rb', line 19 def get_binding binding end |