Class: Byebug::EnableCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/enable.rb

Constant Summary collapse

Subcommands =
[
  ['breakpoints', 2, 'Enable breakpoints. This is used to cancel the '  \
                     'effect of the "disable" command. Give breakpoint' \
                     ' numbers (separated by spaces) as arguments or '  \
                     'no argument at all if you want to reenable '      \
                     'every breakpoint'                                   ],
  ['display'    , 2, 'Enable some expressions to be displayed when '    \
                     'program stops. Arguments are the code numbers of' \
                     ' the expressions to resume displaying. Do "info ' \
                     'display" to see the current list of code numbers'   ]
].map do |name, min, help|
  Subcmd.new(name, min, help)
end

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



92
93
94
95
96
# File 'lib/byebug/commands/enable.rb', line 92

def description
  %{Enable breakpoints or displays.

    This is used to cancel the effect of the "disable" command.}
end

.namesObject



88
89
90
# File 'lib/byebug/commands/enable.rb', line 88

def names
  %w(enable)
end

Instance Method Details

#enable_breakpoints(args) ⇒ Object



79
80
81
# File 'lib/byebug/commands/enable.rb', line 79

def enable_breakpoints(args)
  enable_disable_breakpoints('enable', args)
end

#enable_display(args) ⇒ Object



83
84
85
# File 'lib/byebug/commands/enable.rb', line 83

def enable_display(args)
  enable_disable_display('enable', args)
end

#executeObject



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/byebug/commands/enable.rb', line 65

def execute
  return errmsg "\"enable\" must be followed by \"display\", " \
                "\"breakpoints\" or breakpoint numbers.\n" unless @match[1]

  args = @match[1].split(/[ \t]+/)
  param = args.shift
  subcmd = Command.find(Subcommands, param)
  if subcmd
    send("enable_#{subcmd.name}", args)
  else
    send('enable_breakpoints', args.unshift(param))
  end
end

#regexpObject



61
62
63
# File 'lib/byebug/commands/enable.rb', line 61

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