Module: Pry::ControlDHandler Private
- Defined in:
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
.default(pry_instance) ⇒ Object
Deal with the ^D key being pressed.
Class Method Details
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deal with the ^D key being pressed. Different behaviour in different cases:
- In an expression behave like
- At top-level session behave like
- In a nested session behave like
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
# File 'lib/pry/control_d_handler.rb', line 12 def self.default(pry_instance) if !pry_instance.eval_string.empty? # Clear input buffer. pry_instance.eval_string = '' elsif pry_instance.binding_stack.one? pry_instance.binding_stack.clear throw(:breakout) else # Otherwise, saves current binding stack as old stack and pops last # binding out of binding stack (the old stack still has that binding). cd_state = ::..state_for('cd') cd_state.old_stack = pry_instance.binding_stack.dup pry_instance.binding_stack.pop end end