module PryStackExplorer
def self.bindings_equal?(b1, b2)
-
b2(Binding) -- Second binding. -
b1(Binding) -- First binding.
def self.bindings_equal?(b1, b2) (b1.eval('self') == b2.eval('self')) && (b1.eval('__method__') == b2.eval('__method__')) && (b1.eval('local_variables').map { |v| b1.eval("#{v}") } == b2.eval('local_variables').map { |v| b2.eval("#{v}") }) end
def self.clear_frame_managers(_pry_)
-
_pry_(Pry) -- The Pry instance associated with the frame managers
def self.clear_frame_managers(_pry_) init_frame_hash pop_frame_manager(_pry_) until frame_managers(_pry_).empty? frame_hash.delete(_pry_) # this line should be unnecessary! end
def self.create_and_push_frame_manager(bindings, _pry_)
-
_pry_(Pry) -- The Pry instance associated with the frame manager -
bindings(Array) -- The array of bindings (frames)
def self.create_and_push_frame_manager(bindings, _pry_) init_frame_hash frame_hash[_pry_].push FrameManager.new(bindings, _pry_) end
def self.frame_hash
-
(Hash)- The hash storing all frames for all Pry instances for
def self.frame_hash Thread.current[:__pry_frame_managers__] end
def self.frame_manager(_pry_)
-
(PryStackExplorer::FrameManager)- The currently active frame manager
def self.frame_manager(_pry_) init_frame_hash frame_hash[_pry_].last end
def self.frame_managers(_pry_)
-
(Array)- The stack of Pry::FrameManager objections
Parameters:
-
_pry_(Pry) -- The Pry instance associated with the frame
def self.frame_managers(_pry_) init_frame_hash frame_hash[_pry_] end
def self.init_frame_hash
def self.init_frame_hash Thread.current[:__pry_frame_managers__] ||= Hash.new { |h, k| h[k] = [] } end
def self.pop_frame_manager(_pry_)
-
_pry_(Pry) -- The Pry instance associated with the frame managers
def self.pop_frame_manager(_pry_) init_frame_hash popped = frame_managers(_pry_).pop frame_hash.delete(_pry_) if frame_managers(_pry_).empty? _pry_.backtrace = popped.prior_backtrace popped end