Add Backtrace::Line#absolute_path

This commit is contained in:
Sijawusz Pur Rahnama 2020-12-27 21:55:15 +01:00
parent 1b2e5fcc32
commit f0870daef4

View file

@ -51,6 +51,14 @@ module Backtracer
end end
end end
def absolute_path : String?
return unless path = file
return path if path.starts_with?('/')
if prefix = configuration.src_path
File.join(prefix, path)
end
end
def shard_name : String? def shard_name : String?
relative_path relative_path
.try(&.match(configuration.modules_path_pattern)) .try(&.match(configuration.modules_path_pattern))