From bf917db555843797983e840142d2d0ca713a7727 Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 12 Jun 2024 23:31:45 +0400 Subject: [PATCH] chop function ansi_trace --- lib/formatters/ansi_common.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/formatters/ansi_common.rb b/lib/formatters/ansi_common.rb index 15646a5..f72b649 100644 --- a/lib/formatters/ansi_common.rb +++ b/lib/formatters/ansi_common.rb @@ -3,10 +3,10 @@ require_relative 'ansi_colors' # gather common definitions and functions class AnsiCommon def self.ansi_trace(trace) - match = trace.match(/(↳ )?(.*:\d+):in `(.*)'/) + match = trace.match(/(↳ )?(.*:\d+)(:in `)?(.*')/) # only m2(=file) and m4(=optional function) are useful return trace unless match - _, m2, m3 = match.captures - "➟ #{m2} #{AnsiColors::BOLD}#{m3}#{AnsiColors::CLEAR}" + _, m2, _, m4 = match.captures + "➟ #{m2} #{AnsiColors::BOLD}#{m4.chop}#{AnsiColors::CLEAR}" end end