On 31 Mar 2011, at 08:05, Rob Gleeson wrote:
def trigger_action(sender) a_proc = Proc.new { |var| puts "hello in proc" return 1 } a_proc.call('test') puts "hello after proc" end That code runs without triggering an exception, and prints only "hello in proc" as expected. However, this variation on the code behaves differently:
This shouldn't print "hello after proc". an explicit return should not return control to the caller within a method, it should return for that method. F. ex, 1 should be the return value of trigger_action.
If it were a lambda, that behavior is expected (printing "hello after proc"), so I guess there's a bug somewhere.
P.S: Gabriel, sorry, I replied to you directly instead of to the list :)
- Rob
Oops, sorry Garbiel. I misread your post. "hello IN proc" is indeed printed and expected. :) - Rob