Skip to content

Commit 1d40442

Browse files
committed
respect use_short_path on trace
fix #701
1 parent 4fe0ed0 commit 1d40442

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/debug/frame_info.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def realpath
2727
location.absolute_path
2828
end
2929

30-
def pretty_path
31-
return '#<none>' unless path = self.path
30+
def self.pretty_path path
31+
return '#<none>' unless path
3232
use_short_path = CONFIG[:use_short_path]
3333

3434
case
@@ -45,6 +45,10 @@ def pretty_path
4545
end
4646
end
4747

48+
def pretty_path
49+
FrameInfo.pretty_path path
50+
end
51+
4852
def name
4953
# p frame_type: frame_type, self: self
5054
case frame_type

lib/debug/tracer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def skip_with_pattern?(tp)
7474
end
7575

7676
def out tp, msg = nil, depth = caller.size - 1
77-
location_str = colorize("#{tp.path}:#{tp.lineno}", [:GREEN])
77+
location_str = colorize("#{FrameInfo.pretty_path(tp.path)}:#{tp.lineno}", [:GREEN])
7878
buff = "#{header(depth)}#{msg} at #{location_str}"
7979

8080
if false # TODO: Ractor.main?

0 commit comments

Comments
 (0)