class PryStackExplorer::FrameManager

associated Pry instance to reflect the active frame. It is fully Enumerable.
frames that make up the stack and is responsible for updating the
This class represents a call-stack. It stores the

def change_frame_to(index, run_whereami=true)

Parameters:
  • index (Fixnum) -- The index of the frame.
def change_frame_to(index, run_whereami=true)
  set_binding_index_safely(index)
  if @pry.binding_stack.empty?
    @pry.binding_stack.replace [bindings[binding_index]]
  else
    @pry.binding_stack[-1] = bindings[binding_index]
  end
  @pry.run_command "whereami" if run_whereami
end

def current_frame

Returns:
  • (Binding) - The currently active frame
def current_frame
  bindings[binding_index]
end

def each(&block)

Iterate over all frames
def each(&block)
  bindings.each(&block)
end

def initialize(bindings, _pry_)

def initialize(bindings, _pry_)
  self.bindings      = bindings
  self.binding_index = 0
  @pry               = _pry_
  @user              = {}
  @prior_binding     = _pry_.binding_stack.last
  @prior_backtrace   = _pry_.backtrace
end

def refresh_frame(run_whereami=true)

active binding.
Ensure the Pry instance's active binding is the frame manager's
def refresh_frame(run_whereami=true)
  change_frame_to binding_index, run_whereami
end

def set_binding_index_safely(index)

Parameters:
  • index (Fixnum) -- The index.
def set_binding_index_safely(index)
  if index > bindings.size - 1
    raise Pry::CommandError, "At top of stack, cannot go further!"
  elsif index < -bindings.size
    raise Pry::CommandError, "At bottom of stack, cannot go further!"
  else
    # wrap around negative indices
    index = (bindings.size - 1) + index + 1 if index < 0
    self.binding_index = index
  end
end