Class: Magneto::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/magneto/context.rb

Overview

Adapted from ‘nanoc/base/context.rb` with thanks to Denis Defreyne and contributors.

Direct Known Subclasses

RenderContext, ScriptContext

Instance Method Summary collapse

Constructor Details

#initialize(ivars) ⇒ Context

Returns a new instance of Context.



7
8
9
10
11
12
13
14
15
# File 'lib/magneto/context.rb', line 7

def initialize(ivars)
  super()
  eigenclass = class << self ; self ; end

  ivars.each do |symbol, value|
    instance_variable_set('@' + symbol.to_s, value)
    eigenclass.send(:define_method, symbol) { value } unless eigenclass.send(:respond_to?, symbol)
  end
end

Instance Method Details

#get_bindingObject



17
18
19
# File 'lib/magneto/context.rb', line 17

def get_binding
  binding
end