Class: InfluxReporter::ErrorMessage::Stacktrace

Inherits:
Object
  • Object
show all
Defined in:
lib/influx_reporter/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.



6
7
8
9
# File 'lib/influx_reporter/error_message/stacktrace.rb', line 6

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

Instance Attribute Details

#framesObject (readonly)

Returns the value of attribute frames.



11
12
13
# File 'lib/influx_reporter/error_message/stacktrace.rb', line 11

def frames
  @frames
end

Class Method Details

.from(config, exception) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/influx_reporter/error_message/stacktrace.rb', line 13

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



21
22
23
# File 'lib/influx_reporter/error_message/stacktrace.rb', line 21

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