Class: ErrorData::Backtrace

Inherits:
Object
  • Object
show all
Includes:
Schema::DataStructure
Defined in:
lib/error_data/error_data/backtrace.rb,
lib/error_data/error_data/backtrace/frame.rb

Defined Under Namespace

Classes: Frame

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(backtrace) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/error_data/error_data/backtrace.rb', line 29

def self.parse(backtrace)
  instance = new

  backtrace.each do |frame|
    instance.add_frame(Frame.parse(frame))
  end

  instance
end

Instance Method Details

#add_frame(frame) ⇒ Object Also known as: <<



7
8
9
10
# File 'lib/error_data/error_data/backtrace.rb', line 7

def add_frame(frame)
  frames << frame
  self
end

#each(&blk) ⇒ Object



13
14
15
# File 'lib/error_data/error_data/backtrace.rb', line 13

def each(&blk)
  frames.each &blk
end

#text_framesObject



17
18
19
20
21
# File 'lib/error_data/error_data/backtrace.rb', line 17

def text_frames
  frames.map do |frame|
    frame.to_s
  end
end

#to_aObject



23
24
25
26
27
# File 'lib/error_data/error_data/backtrace.rb', line 23

def to_a
  frames.map do |frame|
    frame.to_h
  end
end