Class: Magneto::Context
- Inherits:
-
Object
- Object
- Magneto::Context
- Defined in:
- lib/magneto/context.rb
Overview
Adapted from ‘nanoc/base/context.rb` with thanks to Denis Defreyne and contributors.
Direct Known Subclasses
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize(ivars) ⇒ Context
constructor
A new instance of Context.
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_binding ⇒ Object
17 18 19 |
# File 'lib/magneto/context.rb', line 17 def get_binding binding end |