# class Byebug::DeleteCommand

Implements breakpoint deletion.

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/delete.rb, line 20
        def self.description
          <<-DESCRIPTION
            del[ete][ nnn...]

            #{short_description}

            Without and argument, deletes all breakpoints. With integer arguments,
            it deletes specific breakpoints.
          DESCRIPTION
        end

regexp() click to toggle source

    # File lib/byebug/commands/delete.rb, line 16
    def self.regexp
      /^\s* del(?:ete)? (?:\s+(.*))?$/x
    end

short_description() click to toggle source

    # File lib/byebug/commands/delete.rb, line 31
    def self.short_description
      "Deletes breakpoints"
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/delete.rb, line 35
    def execute
      unless @match[1]
        Byebug.breakpoints.clear if confirm(pr("break.confirmations.delete_all"))

        return
      end

      @match[1].split(/ +/).each do |number|
        pos, err = get_int(number, "Delete", 1)

        return errmsg(err) unless pos

        if Breakpoint.remove(pos)
          puts(pr("break.messages.breakpoint_deleted", pos: pos))
        else
          errmsg(pr("break.errors.no_breakpoint_delete", pos: pos))
        end
      end
    end