method access to the enclosing method's locals?
- From: Larry Kluger <rubyforum@xxxxxxxxxx>
- Date: Sat, 18 Aug 2007 00:35:11 +0900
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/.
.
- Follow-Ups:
- Re: method access to the enclosing method's locals?
- From: Logan Capaldo
- Re: method access to the enclosing method's locals?
- From: David A. Black
- Re: method access to the enclosing method's locals?
- From: Robert Klemme
- Re: method access to the enclosing method's locals?
- From: Jano Svitok
- Re: method access to the enclosing method's locals?
- From: Olivier Renaud
- Re: method access to the enclosing method's locals?
- Prev by Date: Re: Does singleton variables have any meaning ?
- Next by Date: Re: Does singleton variables have any meaning ?
- Previous by thread: [C ext to Ruby] how to produce from C, a ruby symbol ???
- Next by thread: Re: method access to the enclosing method's locals?
- Index(es):
Relevant Pages
|