class Airbrake::Backtrace::Line

Handles backtrace parsing line by line

Constants

INPUT_FORMAT

regexp (optionnally allowing leading X: for windows support)

Attributes

file[R]

The file portion of the line (such as app/models/user.rb)

method_name[R]

The method_name of the line (such as index)

number[R]

The line number portion of the line

Public Class Methods

new(file, number, method_name) click to toggle source
# File lib/airbrake/backtrace.rb, line 28
def initialize(file, number, method_name)
  @file   = file
  @number = number
  @method_name = method_name
end
parse(unparsed_line) click to toggle source

Parses a single line of a given backtrace @param [String] unparsed_line The raw line from caller or some backtrace @return [Line] The parsed backtrace line

# File lib/airbrake/backtrace.rb, line 23
def self.parse(unparsed_line)
  _, file, number, method_name = unparsed_line.match(INPUT_FORMAT).to_a
  new(file, number, method_name)
end

Public Instance Methods

==(other) click to toggle source
# File lib/airbrake/backtrace.rb, line 39
def ==(other)
  to_s == other.to_s
end
inspect() click to toggle source
# File lib/airbrake/backtrace.rb, line 43
def inspect
  "<Line:#{to_s}>"
end
to_s() click to toggle source

Reconstructs the line in a readable fashion

# File lib/airbrake/backtrace.rb, line 35
def to_s
  "#{file}:#{number}:in `#{method_name}'"
end