Class: Bourdain::Helpers::Locals

Inherits:
Object
  • Object
show all
Defined in:
lib/bourdain/helpers/locals.rb

Instance Method Summary collapse

Constructor Details

#initialize(locals) ⇒ Locals

Returns a new instance of Locals.



4
5
6
7
8
9
10
11
12
# File 'lib/bourdain/helpers/locals.rb', line 4

def initialize locals
  locals.each do |name, value|
    instance_variable_set "@#{name}", value
    metaclass = class << self ; self ; end
    metaclass.send(:define_method, name) do
      instance_variable_get("@#{name}")
    end
  end
end

Instance Method Details

#bindObject



14
# File 'lib/bourdain/helpers/locals.rb', line 14

def bind ; binding end