Class: Bourdain::Helpers::Locals
- Inherits:
-
Object
- Object
- Bourdain::Helpers::Locals
- Defined in:
- lib/bourdain/helpers/locals.rb
Instance Method Summary collapse
- #bind ⇒ Object
-
#initialize(locals) ⇒ Locals
constructor
A new instance of Locals.
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 = class << self ; self ; end .send(:define_method, name) do instance_variable_get("@#{name}") end end end |
Instance Method Details
#bind ⇒ Object
14 |
# File 'lib/bourdain/helpers/locals.rb', line 14 def bind ; binding end |