Hi,

How can a method gain access to the enclosing method's locals?

def go2(arg)
  def hi
    puts "Hi #{arg}!"
  end

  a={:h => :hi}
  send(a[:h])
end

go2 'Larry' ==>> NameError: undefined local variable or method `arg' for
main:Object

In go2, is there a clean way for the hi method to have access to the
arg local?

Thanks!

Larry
-- 
Posted via http://www.ruby-forum.com/.