Class: Opbeat::ErrorMessage::Stacktrace

Inherits:
Object
  • Object
show all
Defined in:
lib/opbeat/error_message/stacktrace.rb

Defined Under Namespace

Classes: Frame

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, frames) ⇒ Stacktrace

Returns a new instance of Stacktrace.



5
6
7
# File 'lib/opbeat/error_message/stacktrace.rb', line 5

def initialize config, frames
  @config, @frames = config, frames
end

Instance Attribute Details

#framesObject (readonly)

Returns the value of attribute frames.



9
10
11
# File 'lib/opbeat/error_message/stacktrace.rb', line 9

def frames
  @frames
end

Class Method Details

.from(config, exception) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/opbeat/error_message/stacktrace.rb', line 11

def self.from config, exception
  return unless exception.backtrace

  new(config, exception.backtrace.reverse.map do |line|
    Frame.from_line config, line
  end)
end

Instance Method Details

#to_hObject



19
20
21
# File 'lib/opbeat/error_message/stacktrace.rb', line 19

def to_h
  { frames: frames.map(&:to_h) }
end