Method: NewRelic::Agent::Threading::BacktraceNode#parse_backtrace_frame

Defined in:
lib/new_relic/agent/threading/backtrace_node.rb

#parse_backtrace_frame(frame) ⇒ Object

Returns [filename, method, line number]



127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/new_relic/agent/threading/backtrace_node.rb', line 127

def parse_backtrace_frame(frame)
  # TODO: OLD RUBIES - Ruby 3.3
  # The (?:`|') non-capturing group can be removed when the agent
  # drops support for Ruby 3.3
  # This group is used to capture the pre-Ruby 3.4.0 backtrace syntax.
  # Example frame:
  # Ruby 3.3.0 and below
  # "irb.rb:69:in `catch'"
  # Ruby 3.4.0+
  # "irb.rb:69:in 'Kernel#catch'"
  frame =~ /([^:]*)(\:(\d+))?\:in (?:`|')(.*)'/
  [$1, $4, $3] # sic
end