Class: Crashdesk::Backtrace::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/crashdesk/backtrace.rb

Constant Summary collapse

INPUT_FORMAT =

regexp taken from Airbrake

%r{^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, number, method) ⇒ Line

Returns a new instance of Line.



19
20
21
22
23
# File 'lib/crashdesk/backtrace.rb', line 19

def initialize(file, number, method)
  self.file   = file
  self.number = number
  self.method = method
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



12
13
14
# File 'lib/crashdesk/backtrace.rb', line 12

def file
  @file
end

#methodObject

Returns the value of attribute method.



12
13
14
# File 'lib/crashdesk/backtrace.rb', line 12

def method
  @method
end

#numberObject

Returns the value of attribute number.



12
13
14
# File 'lib/crashdesk/backtrace.rb', line 12

def number
  @number
end

Class Method Details

.parse(unparsed_line) ⇒ Object



14
15
16
17
# File 'lib/crashdesk/backtrace.rb', line 14

def self.parse(unparsed_line)
  _, file, number, method = unparsed_line.match(INPUT_FORMAT).to_a
  new(file, number, method)
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
# File 'lib/crashdesk/backtrace.rb', line 29

def ==(other)
  to_s == other.to_s
end

#inspectObject



33
34
35
# File 'lib/crashdesk/backtrace.rb', line 33

def inspect
  "<Line:#{to_s}>"
end

#to_sObject



25
26
27
# File 'lib/crashdesk/backtrace.rb', line 25

def to_s
  "#{file}:#{number}:in `#{method}'"
end