Class: Errplane::Backtrace::Line

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Line

Returns a new instance of Line.



10
11
12
# File 'lib/errplane/backtrace.rb', line 10

def initialize(line)
  _, @file, @number, @method = line.match(FORMAT).to_a
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/errplane/backtrace.rb', line 6

def file
  @file
end

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/errplane/backtrace.rb', line 8

def method
  @method
end

#numberObject (readonly)

Returns the value of attribute number.



7
8
9
# File 'lib/errplane/backtrace.rb', line 7

def number
  @number
end

Instance Method Details

#inspectObject



18
19
20
# File 'lib/errplane/backtrace.rb', line 18

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

#to_sObject



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

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