Sha256: 25b11ff1281d2f39b63ab82ae8f89c4552534faad19638ad5f412925252d3683

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

require 'byebug/command'

module Byebug
  #
  # Implements breakpoint deletion.
  #
  class DeleteCommand < Command
    self.allow_in_post_mortem = false
    self.allow_in_control = true

    def regexp
      /^\s* del(?:ete)? (?:\s+(.*))?$/x
    end

    def execute
      unless @match[1]
        if confirm(pr('break.confirmations.delete_all'))
          Byebug.breakpoints.clear
        end

        return nil
      end

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

        return errmsg(err) unless pos

        unless Breakpoint.remove(pos)
          return errmsg(pr('break.errors.no_breakpoint_delete', pos: pos))
        end
      end
    end

    class << self
      def names
        %w(delete)
      end

      def description
        prettify <<-EOD
          del[ete][ nnn...]

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
byebug-4.0.4 lib/byebug/commands/delete.rb
byebug-4.0.3 lib/byebug/commands/delete.rb
byebug-4.0.2 lib/byebug/commands/delete.rb
byebug-4.0.1 lib/byebug/commands/delete.rb
byebug-4.0.0 lib/byebug/commands/delete.rb