Class: RailsOrbit::Backtrace::Frame

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

Overview

A single backtrace frame. ‘parsed?` is false for lines we could not parse (kept verbatim in `raw` so nothing is silently dropped).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#applicationObject

Returns the value of attribute application

Returns:

  • (Object)

    the current value of application



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

def application
  @application
end

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



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

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



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

def line
  @line
end

#method_nameObject

Returns the value of attribute method_name

Returns:

  • (Object)

    the current value of method_name



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

def method_name
  @method_name
end

#rawObject

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



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

def raw
  @raw
end

Instance Method Details

#application?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/rails_orbit/backtrace.rb', line 19

def application?
  application
end

#display_pathObject



27
28
29
30
31
# File 'lib/rails_orbit/backtrace.rb', line 27

def display_path
  return raw unless parsed?

  application ? Backtrace.relative_to_app(file) : Backtrace.shorten_gem(file)
end

#parsed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/rails_orbit/backtrace.rb', line 23

def parsed?
  !file.nil?
end

#to_sObject



33
34
35
36
37
38
# File 'lib/rails_orbit/backtrace.rb', line 33

def to_s
  return raw unless parsed?

  suffix = method_name ? " in #{method_name}" : ""
  "#{display_path}:#{line}#{suffix}"
end