Class: Raven::StacktraceInterface::Frame

Inherits:
Interface
  • Object
show all
Defined in:
lib/raven/interfaces/stack_trace.rb

Overview

Not actually an interface, but I want to use the same style

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Interface

inherited, registered

Constructor Details

#initialize(*arguments) ⇒ Frame

Returns a new instance of Frame.



24
25
26
# File 'lib/raven/interfaces/stack_trace.rb', line 24

def initialize(*arguments)
  super(*arguments)
end

Instance Attribute Details

#abs_pathObject

Returns the value of attribute abs_path.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def abs_path
  @abs_path
end

#context_lineObject

Returns the value of attribute context_line.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def context_line
  @context_line
end

#functionObject

Returns the value of attribute function.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def function
  @function
end

#in_appObject

Returns the value of attribute in_app.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def in_app
  @in_app
end

#linenoObject

Returns the value of attribute lineno.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def lineno
  @lineno
end

#moduleObject

Returns the value of attribute module.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def module
  @module
end

#post_contextObject

Returns the value of attribute post_context.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def post_context
  @post_context
end

#pre_contextObject

Returns the value of attribute pre_context.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def pre_context
  @pre_context
end

#varsObject

Returns the value of attribute vars.



21
22
23
# File 'lib/raven/interfaces/stack_trace.rb', line 21

def vars
  @vars
end

Instance Method Details

#filenameObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/raven/interfaces/stack_trace.rb', line 28

def filename
  return if abs_path.nil?
  return @filename if instance_variable_defined?(:@filename)

  prefix =
    if under_project_root? && in_app
      project_root
    elsif under_project_root?
      longest_load_path || project_root
    else
      longest_load_path
    end

  @filename = prefix ? abs_path[prefix.to_s.chomp(File::SEPARATOR).length + 1..-1] : abs_path
end

#to_hash(*args) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/raven/interfaces/stack_trace.rb', line 44

def to_hash(*args)
  data = super(*args)
  data[:filename] = filename
  data.delete(:vars) unless vars && !vars.empty?
  data.delete(:pre_context) unless pre_context && !pre_context.empty?
  data.delete(:post_context) unless post_context && !post_context.empty?
  data.delete(:context_line) unless context_line && !context_line.empty?
  data
end