Skip to content

Commit 7942946

Browse files
committed
Update ruby regex to support ruby 3.4 #1509
1 parent 391ae2d commit 7942946

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/elastic_apm/stacktrace_builder.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module ElasticAPM
2424
# @api private
2525
class StacktraceBuilder
2626
JAVA_FORMAT = /^(.+)\.([^.]+)\(([^:]+):(\d+)\)$/.freeze
27-
RUBY_FORMAT = /^(.+?):(\d+)(?::in `(.+?)')?$/.freeze
27+
RUBY_FORMAT = /^(.+?):(\d+)(?::in ['`](.+#)?(.+?)')?$/.freeze
2828

2929
RUBY_VERS_REGEX = %r{ruby(/gems)?[-/](\d+\.)+\d}.freeze
3030
JRUBY_ORG_REGEX = %r{org/jruby}.freeze
@@ -77,9 +77,9 @@ def parse_line(line)
7777
ruby_match = line.match(RUBY_FORMAT)
7878

7979
if ruby_match
80-
_, file, number, method = ruby_match.to_a
80+
_, file, number, module_name, method = ruby_match.to_a
8181
file.sub!(/\.class$/, '.rb')
82-
module_name = nil
82+
module_name&.sub!('#', '')
8383
else
8484
java_match = line.match(JAVA_FORMAT)
8585
_, module_name, method, file, number = java_match.to_a

0 commit comments

Comments
 (0)