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.


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)