class Backtracie::Location

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

Attributes

absolute_path[RW]
base_label[RW]
label[RW]
lineno[RW]
path[RW]
qualified_method_name[RW]

Public Class Methods

new(absolute_path, base_label, label, lineno, path, qualified_method_name, debug) click to toggle source

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

# File lib/backtracie/location.rb, line 33
def initialize(absolute_path, base_label, label, lineno, path, qualified_method_name, debug)
  @absolute_path = absolute_path
  @base_label = base_label
  @label = label
  @lineno = lineno
  @path = path
  @qualified_method_name = qualified_method_name
  @debug = debug

  freeze
end

Public Instance Methods

fancy_to_s() click to toggle source

Still WIP

# File lib/backtracie/location.rb, line 54
def fancy_to_s
  if @lineno != 0
    "#{@path}:#{@lineno}:in #{@qualified_method_name}"
  else
    "#{@path}:in #{@qualified_method_name}"
  end
end
to_s() click to toggle source
# File lib/backtracie/location.rb, line 45
def to_s
  if @lineno != 0
    "#{@path}:#{@lineno}:in `#{@label}'"
  else
    "#{@path}:in `#{@label}'"
  end
end