Class: Backtracie::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/backtracie/location.rb

Overview

A more advanced version of Ruby’s built-in Thread::Backtrace::Location

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(absolute_path, base_label, label, lineno, path, debug) ⇒ Location

Note: The order of arguments is hardcoded in the native extension in the ‘new_location` function – keep them in sync



32
33
34
35
36
37
38
39
40
41
# File 'lib/backtracie/location.rb', line 32

def initialize(absolute_path, base_label, label, lineno, path, debug)
  @absolute_path = absolute_path
  @base_label = base_label
  @label = label
  @lineno = lineno
  @path = path
  @debug = debug

  freeze
end

Instance Attribute Details

#absolute_pathObject

Returns the value of attribute absolute_path.



24
25
26
# File 'lib/backtracie/location.rb', line 24

def absolute_path
  @absolute_path
end

#base_labelObject

Returns the value of attribute base_label.



25
26
27
# File 'lib/backtracie/location.rb', line 25

def base_label
  @base_label
end

#labelObject

Returns the value of attribute label.



26
27
28
# File 'lib/backtracie/location.rb', line 26

def label
  @label
end

#linenoObject

Returns the value of attribute lineno.



27
28
29
# File 'lib/backtracie/location.rb', line 27

def lineno
  @lineno
end

#pathObject

Returns the value of attribute path.



28
29
30
# File 'lib/backtracie/location.rb', line 28

def path
  @path
end

Instance Method Details

#to_sObject



43
44
45
46
47
48
49
# File 'lib/backtracie/location.rb', line 43

def to_s
  if @lineno != 0
    "#{@path}:#{@lineno}:in `#{@label}'"
  else
    "#{@path}:in `#{@label}'"
  end
end