module DEBUGGER__::TrapInterceptor - debug: Ruby Standard Library Documentation

# module DEBUGGER__::TrapInterceptor

### Public Instance Methods

trap(sig, *command, &command_proc) click to toggle source
Calls superclass method

    # File debug-1.10.0/lib/debug/session.rb, line 2551
    def trap sig, *command, &command_proc
      sym =
        case sig
        when String
          sig.to_sym
        when Integer
          Signal.signame(sig)&.to_sym
        else
          sig
        end

      case sym
      when :INT, :SIGINT
        if defined?(SESSION) && SESSION.active? && SESSION.intercept_trap_sigint?
          return SESSION.save_int_trap(command.empty? ? command_proc : command.first)
        end
      end

      super
    end