On Mar 14, 2011, at 6:24 PM, 7stud -- wrote:
> Why doesn't this work:
> 
> def my_meth(*args)
>  yield
>  p args
> end
> 
> my_proc = Proc.new {puts 'hello'}
> my_meth(1, 2, 3, &my_proc )  #=>'hello' [1, 2, 3]
> 
> obj = Object.new
> m = obj.method(my_meth)
> m.call([10, 20, 30], &my_proc)  #LocalJumpError at yield line

Your comment about LocalJumpError should be one line above and it
occurs because you are calling my_meth without a block and are
attempting to yield to the non-existent block. You don't want
to invoke my_meth there, you want to *name* it:

> m = obj.method('my_meth')


I think you are adding a confusing difference when you try to invoke
my_method on the last line by packaging up three arguments in an array.
If you want to follow the pattern you used when you called my_meth
directly you should be doing:

> m.call(10, 20, 30, &my_proc) 


Gary Wright