Hi -- On Sat, 18 Aug 2007, Logan Capaldo wrote: > On 8/17/07, David A. Black <dblack / rubypal.com> wrote: >> Hi -- >> >> On Sat, 18 Aug 2007, Larry Kluger wrote: >> >>> Hi Everybody, >>> >>> Thank you for your help. To keep things dry, my main method uses one of >>> a number of methods, depending on the value of an argument. A hash is >>> used as a selector to choose the right child method. >>> >>> The child methods need some data, I wanted to see how they could gain >>> access to the locals of the calling method, ie, the main method. >>> >>> I appreciate the posts; I'll continue to pass the arguments, which is >>> working fine. >>> >>> Btw, I find it a bit lacking that the syntax checker allows me to >>> declare a method inside another method since such things don't exist. >>> (Per Olivier's helpful post.) >> >> I wouldn't say it doesn't exist; it's just that the lexically inner >> definition isn't scoped to the outer definition. This is relatively >> new (1.8.6, if I remember correctly), and made it easier to do >> something that was always possible anyway with class_eval + >> define_method. >> > ISTR def foo; def bar; end; end working in 1.8.4 and possibly even > 1.8.2. (I didn't hop aboard the ruby train before 1.8.2 though). I > know I've used def foo; def bar before 1.8.6. I think I meant to type 1.8.4, though I'm semi-guessing anyway. I do seem to remember that it was an intra-1.8 change, rather than as between 1.6 and 1.8, but I'm not sure. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)