Trying to debug the mail gem, I added in a binding.pry. Unfortunately the method I want to inspect is called by its == implementation, which pry-stack_explorer calls in a :before_session hook; so the binding.pry call recurses indefinitely (though slowly).
The error I encountered is here: http://git.io/br1WmQ
ruby -I./lib -rmail -e'Mail::Message.new("foo").to_s'
A (silly) minimal example is:
require 'pry'
class Foo
def ==(r)
binding.pry
end
end
Foo.new == 1
One easy fix would be to use .equal? instead of ==. Otherwise we can try wrapping some hooks in Pry.critical_section to save the user from the infinite recursion.
Trying to debug the mail gem, I added in a
binding.pry
. Unfortunately the method I want to inspect is called by its==
implementation, which pry-stack_explorer calls in a:before_session
hook; so thebinding.pry
call recurses indefinitely (though slowly).The error I encountered is here: http://git.io/br1WmQ ruby -I./lib -rmail -e'Mail::Message.new("foo").to_s'
A (silly) minimal example is:
One easy fix would be to use
.equal?
instead of==
. Otherwise we can try wrapping some hooks inPry.critical_section
to save the user from the infinite recursion.