Class: Rollbar::Item::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/rollbar/item/frame.rb

Overview

Representation of the trace data per frame in the payload

Constant Summary collapse

MAX_CONTEXT_LENGTH =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backtrace, frame, options = {}) ⇒ Frame

Returns a new instance of Frame.



13
14
15
16
17
# File 'lib/rollbar/item/frame.rb', line 13

def initialize(backtrace, frame, options = {})
  @backtrace = backtrace
  @frame = frame
  @configuration = options[:configuration]
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



9
10
11
# File 'lib/rollbar/item/frame.rb', line 9

def backtrace
  @backtrace
end

#configurationObject (readonly)

Returns the value of attribute configuration.



9
10
11
# File 'lib/rollbar/item/frame.rb', line 9

def configuration
  @configuration
end

#frameObject (readonly)

Returns the value of attribute frame.



9
10
11
# File 'lib/rollbar/item/frame.rb', line 9

def frame
  @frame
end

Instance Method Details

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rollbar/item/frame.rb', line 19

def to_h
  # parse the line
  match = frame.match(/(.*):(\d+)(?::in `([^']+)')?/)

  return unknown_frame unless match

  filename = match[1]
  lineno = match[2].to_i
  frame_data = {
    :filename => filename,
    :lineno => lineno,
    :method => match[3]
  }

  frame_data.merge(extra_frame_data(filename, lineno))
end