Class: PryMoves::BindingsStack
- Inherits:
-
Array
- Object
- Array
- PryMoves::BindingsStack
- Defined in:
- lib/pry-moves/bindings_stack.rb
Instance Method Summary collapse
- #fits_for_initial_frame(b) ⇒ Object
- #initial_frame ⇒ Object
-
#initialize(options) ⇒ BindingsStack
constructor
A new instance of BindingsStack.
- #suggest_initial_frame_index ⇒ Object
Constructor Details
#initialize(options) ⇒ BindingsStack
Returns a new instance of BindingsStack.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/pry-moves/bindings_stack.rb', line 3 def initialize @options = bindings = binding.callers # binding_of_caller has bug and always returns callers of current binding, # no matter at which binding method is called. So no need to pass here binding pre_callers = Thread.current[:pre_callers] bindings = bindings + pre_callers if pre_callers concat remove_internal_frames(bindings) set_indices mark_vapid_frames end |
Instance Method Details
#fits_for_initial_frame(b) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/pry-moves/bindings_stack.rb', line 23 def fits_for_initial_frame b PryMoves.step_in_everywhere or not b.hidden and ( @options[:is_error] or b.eval("__method__") != :initialize ) end |
#initial_frame ⇒ Object
19 20 21 |
# File 'lib/pry-moves/bindings_stack.rb', line 19 def initial_frame find {|b| fits_for_initial_frame b} end |
#suggest_initial_frame_index ⇒ Object
14 15 16 17 18 |
# File 'lib/pry-moves/bindings_stack.rb', line 14 def suggest_initial_frame_index m = PryMoves::TracedMethod.last return 0 if m and m.binding_inside?(first) index {|b| fits_for_initial_frame b} || 0 end |