Skip to content

Commit 183e191

Browse files
committed
clear hooks on pry version > 0.11.x not to display source code
1 parent 946281d commit 183e191

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/better_errors/repl/pry.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def initialize(binding, exception)
4343
@input = BetterErrors::REPL::Pry::Input.new
4444
@output = BetterErrors::REPL::Pry::Output.new
4545
@pry = ::Pry.new input: @input, output: @output
46-
@pry.hooks.clear_all if defined?(@pry.hooks.clear_all)
46+
@pry.hooks.clear_event_hooks(:before_session) if @pry.hooks.respond_to?(:clear_event_hooks) # pry version >= 0.11.x
47+
@pry.hooks.clear_all if @pry.hooks.respond_to?(:clear_all) # pry version <= 0.10.x
4748
store_last_exception exception
4849
@fiber.resume
4950
end

0 commit comments

Comments
 (0)