You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: control_d_handler.rb
    path of file: ./repos/pry/lib/pry
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class Pry
  # @api private
  # @since v0.13.0
  module ControlDHandler
    # Deal with the ^D key being pressed. Different behaviour in different
    # cases:
    #   1. In an expression behave like `!` command.
    #   2. At top-level
    
    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 = Pry::CommandState.default.state_for('cd')
        cd_state.old_stack = pry_instance.binding_stack.dup
        pry_instance.binding_stack.pop
      end