rubinius/rubinius — pull request #1814 by ryoqun (2012-07-16 02:18:07+00:00)
Title: Make Proc::from_env reset klass if appropriate

Make Proc::from_env duplicate a passed object (env) and reset its klass if the
receiver class is different from env's class to support following code:

class MyProc < Proc
end
MyProc.new(&proc) # => should return an instance of MyProc

By this modification, we shoudn't use the Proc::from_env to assign a block
to a method parameter like this:

def each(&block)
# ...
end

Instead, we should use the original Proc::from_env. The reason is that when a
sub-classed proc instance is passed to such a method, the proc would
necessarily be converted to a Proc by the modified Proc::from_env.