How is Proc#== evaluated? RDoc says:

prc == other_proc → true or false

Returns true if prc is the same object as other_proc, or if they are both procs with the same body.

But it is not clear what counts as having "the same body". One condition seems to be that the arity must be the same:

->{} == ->{} # => true
->{} == ->x{} # => false
->x{} == ->x{} # => true
->x{} == ->y{} # => true
->x{} == ->y,z{} # => false

But there is more than that. As RDoc says, the body matters:

->{nil} == ->{nil} # => true
->{nil} == ->{false} # => false
->{false} == ->{false} # => true

But at the same time, it looks like the proc is not fully evaluated:

->{} == ->{nil} # => false
->{false} == ->{1 == 2} # => false

To what extent is the body evaluated?

Edit
Report