Skip to content

Commit 4756121

Browse files
committed
allow break-ing on REPL-defined methods
1 parent 674e0b2 commit 4756121

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/pry-debugger/breakpoints.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ module Breakpoints
1010

1111
# Add a new breakpoint.
1212
def add(file, line, expression = nil)
13-
raise ArgumentError, 'Invalid file!' unless File.exist?(file)
13+
if !File.exist?(file) && file != Pry.eval_path
14+
raise ArgumentError, 'Invalid file!' unless File.exist?(file)
15+
end
1416
validate_expression expression
1517

1618
Pry.processor.debugging = true
17-
Debugger.add_breakpoint(File.expand_path(file), line, expression)
19+
20+
path = file == Pry.eval_path ? file : File.expand_path(file)
21+
Debugger.add_breakpoint(path, line, expression)
1822
end
1923

2024
# Change the conditional expression for a breakpoint.

0 commit comments

Comments
 (0)