Class: Debugger::DisableCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug-ide/commands/enable.rb

Overview

:nodoc:

Constant Summary collapse

Subcommands =
[
   ['breakpoints', 1, "Disable some breakpoints",
"Arguments are breakpoint numbers with spaces in between.
A disabled breakpoint is not forgotten, but has no effect until reenabled."],
   ['display', 1, "Disable some display expressions when program stops",
"Arguments are the code numbers of the expressions to stop displaying.
Do \"info display\" to see current list of code numbers."],
  ].map do |name, min, short_help, long_help| 
  SubcmdStruct.new(name, min, short_help, long_help)
end

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, file_filter_supported?, #find, inherited, #initialize, load_commands, #match, method_missing, options, unescape_incoming

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(args) ⇒ Object


171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/ruby-debug-ide/commands/enable.rb', line 171

def help(args)
  if args[1] 
    s = args[1]
    subcmd = Subcommands.find do |try_subcmd| 
      (s.size >= try_subcmd.min) and
        (try_subcmd.name[0..s.size-1] == s)
    end
    if subcmd
      str = subcmd.short_help + '.'
      str += "\n" + subcmd.long_help if subcmd.long_help
      return str
    else
      return "Invalid 'disable' subcommand '#{args[1]}'."
    end
  end
  s = %{
    Disable some things.

    A disabled item is not forgotten, but has no effect until reenabled.
    Use the "enable" command to have it take effect again.
    -- 
    List of disable subcommands:
    --  
  }
  for subcmd in Subcommands do
    s += "disable #{subcmd.name} -- #{subcmd.short_help}\n"
  end
  return s
end

.help_commandObject


167
168
169
# File 'lib/ruby-debug-ide/commands/enable.rb', line 167

def help_command
  'disable'
end

Instance Method Details

#disable_breakpoints(args) ⇒ Object


158
159
160
# File 'lib/ruby-debug-ide/commands/enable.rb', line 158

def disable_breakpoints(args)
  enable_disable_breakpoints("Disable", args)
end

#disable_display(args) ⇒ Object


162
163
164
# File 'lib/ruby-debug-ide/commands/enable.rb', line 162

def disable_display(args)
  enable_disable_display("Disable", args)
end

#executeObject


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/ruby-debug-ide/commands/enable.rb', line 142

def execute
  if not @match[1]
    errmsg "\"disable\" must be followed \"display\", \"breakpoints\"" +
      " or breakpoint numbers.\n"
  else
    args = @match[1].split(/[ \t]+/)
    param = args.shift
    subcmd = find(Subcommands, param)
    if subcmd
      send("disable_#{subcmd.name}", args)
    else
      send("disable_breakpoints", args.unshift(param))
    end
  end
end

#regexpObject


138
139
140
# File 'lib/ruby-debug-ide/commands/enable.rb', line 138

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