On Tue, 5 Dec 2006, J2M wrote:

> I would like to invoke method_missing on baz in this code;
>
> x = Foo.new
> x.bar { baz }
>
> I tried the following, and although the method is added to the proc
> objects singleton class, the method_missing method never gets called.
> Is there any way to achieve this? My current code (that doesn't work)
> is below;
>
> class Foo
>
>  def bar(*values, &block)
>
>    if block_given?
>
>      class << block
>        def method_missing(m, *args, &block)
>          puts "missing #{m}"
>        end
>      end
>
>      block.call
>
>    end
>  end
> end

but block __will__ respond_to? 'call' - ergo your method_missing hook will
never fire?  what are you trying to do?

-a
-- 
if you want others to be happy, practice compassion.
if you want to be happy, practice compassion.  -- the dalai lama