# class Byebug::EnableDisableCommand

Enabling or disabling custom display expressions or breakpoints.

### Constants

Subcommands

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 110
    def description
      prettify <<-EOD
        (en|dis)[able][[ (breakpoints|display)][ n1[ n2[ ...[ nn]]]]]

         Enables or disables breakpoints or displays.

         "enable" by itself enables all breakpoints, just like
         "enable breakpoints". On the other side, "disable" or
         "disable breakpoints" disable all breakpoints.

         You can also specify a space separated list of breakpoint numbers to
         enable or disable specific breakpoints. You can use either
         "enable <id1> ... <idn>" or "enable breakpoints <id1> ... <idn>" and
         the same with "disable".

         If instead of "breakpoints" you specify "display", the command will
         work exactly the same way, but displays will get enabled/disabled
         instead of breakpoints.
       EOD
    end

names() click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 106
    def names
      %w((en|dis)able)
    end

### Public Instance Methods

disable_breakpoints(args) click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 97
    def disable_breakpoints(args)
      enable_disable_breakpoints('disable', args)
    end

disable_display(args) click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 101
    def disable_display(args)
      enable_disable_display('disable', args)
    end

enable_breakpoints(args) click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 89
    def enable_breakpoints(args)
      enable_disable_breakpoints('enable', args)
    end

enable_display(args) click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 93
    def enable_display(args)
      enable_disable_display('enable', args)
    end

execute() click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 74
    def execute
      cmd = @match[1] == 'dis' ? 'disable' : 'enable'

      return errmsg(pr('toggle.errors.syntax', toggle: cmd)) unless @match[2]

      args = @match[2].split(/ +/)
      param = args.shift
      subcmd = Command.find(Subcommands, param)
      if subcmd
        send("#{cmd}_#{subcmd.name}", args)
      else
        send("#{cmd}_breakpoints", args.unshift(param))
      end
    end

regexp() click to toggle source

    # File lib/byebug/commands/enable_disable.rb, line 70
    def regexp
      /^\s* (dis|en)(?:able)? (?:\s+(.+))? \s*$/x
    end