"Martin Pirker" <crf / sbox.tu-graz.ac.at> schrieb im Newsbeitrag
news:41179c87$0$18702$3b214f66 / aconews.univie.ac.at...
> Robert Klemme <bob.news / gmx.net> wrote:
> > Try this:
>
> > h["func1"] = Outer::Inner.method :dothis
> > h["func2"] = method :whatever
>
> [defs]
>
> > Outer::Inner::dothis(3)
> > h["func2"].call 9
> > h["func1"].call 7
>
>
> appears to work with .call instead of __send__, but this requires def
first
> otherwise one can't get the .method (of course...)
>
>   ztrick.rb:5: uninitialized constant Outer (NameError)
>
>
> I'll try do guarantee that the def is always first... hmmm

Well, that's the standard approach, isn't it?  Of course if you want it lazy
you can use blocks to defer execution of #method like this:

$ irbs
>> h={ "func1" => lambda { Outer::Inner.method :dothis },
?> "func2" => lambda { method :whatever } }
=> {"func1"=>#<Proc:0x10183188@(irb):1>,
"func2"=>#<Proc:0x10183020@(irb):2>}
>> def whatever(x) puts "Whatever #{x}" end
=> nil
>> h["func2"].call.call "you want"
Whatever you want
=> nil

Btw, what problem are you trying to solve?

Kind regards

    robert