From: Matt Maycock Date: 2004-09-17T03:42:26+09:00 Subject: Re: Changing outside variables inside a proc > Is there any way to change an outside-scoped object inside a proc? Such > as: > > a = "Foo" > b = "bar" > proc = Proc.new { |val1, val2| val1, val2 = "boo", "baz" } > proc.call( a, b ) > > # a and b are still "Foo" and "bar" > > I don't believe this is possible.. but would be very nice for creating a > collect! method for a user-defined object. Thanks a, b = "foo", "bar" proc = Proc.new {|a, b|} proc.call(1, 2) # a, b => 1, 2