improved breaking up file:line syntax to take care of windows c:/blah.rb:10 edgecase

This commit is contained in:
John Mair 2011-09-07 20:58:58 +12:00
parent d209414ed9
commit 95cd5f4724
1 changed files with 5 additions and 1 deletions

View File

@ -151,7 +151,11 @@ class Pry
line = eval_string.lines.count + 1 line = eval_string.lines.count + 1
should_reload_locally = opts[:n] ? false : true should_reload_locally = opts[:n] ? false : true
else else
file_name, line = File.expand_path(args.first).split(/:/) # break up into file:line
/(:(\d+))?$/ =~ File.expand_path(args.first)
# $` is pre-match
file_name, line = [$`, $2]
line = line ? line.to_i : opts[:l].to_i line = line ? line.to_i : opts[:l].to_i
end end