Class: Stackdo::CallStack

Inherits:
Object
  • Object
show all
Defined in:
lib/stackdo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(frames:) ⇒ CallStack

Returns a new instance of CallStack.



83
84
85
# File 'lib/stackdo.rb', line 83

def initialize(frames:)
  @frames = frames
end

Instance Attribute Details

#framesObject (readonly)

Returns the value of attribute frames.



73
74
75
# File 'lib/stackdo.rb', line 73

def frames
  @frames
end

Class Method Details

.from_hereObject



75
76
77
78
79
80
81
# File 'lib/stackdo.rb', line 75

def self.from_here
  frames = Stackdo::call_stack_bindings(binding).map do |binding|
    Stackdo::Frame.from_binding(binding)
  end

  CallStack.new(frames: frames)
end

Instance Method Details

#walk(&block) ⇒ Object



87
88
89
# File 'lib/stackdo.rb', line 87

def walk(&block)
  frames.each(&block)
end