Issue #11160 has been reported by Alex Yu.

----------------------------------------
Bug #11160: Subclasses of Proc converted when passed to a block
https://bugs.ruby-lang.org/issues/11160

* Author: Alex Yu
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
As Subclasses of Proc are passed as-is when sent to methods as blocks, it would be expected that the same behavior occurs when passing such a subclass of Proc to a block. However, Ruby's block.call somehow converts the block to a Proc, losing the passed subclass. Is this a bug, or is there a particular reason for this design?

Here is an example:

> class MyClass < Proc
> end
=> nil

> def foo (&x)
> p x.class
> end
=> :foo

> x = Proc.new {|&x| p x.class}
=> #<Proc:0x007faf0b042f60@(irb):77>

> z = MyClass.new {}
=> #<MyClass:0x007faf0b0393c0@(irb):78>

> foo &z
MyClass
=> MyClass

> x.call &z
Proc
=> Proc



-- 
https://bugs.ruby-lang.org/