Class: Debugger::EnableCommand
- Inherits:
-
Command
- Object
- Command
- Debugger::EnableCommand
show all
- Defined in:
- lib/ruby-debug/commands/enable.rb
Overview
Constant Summary
collapse
- Subcommands =
[
['breakpoints', 2, "Enable specified breakpoints",
"Give breakpoint numbers (separated by spaces) as arguments.
This is used to cancel the effect of the \"disable\" command."
],
['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 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, #find, inherited, #initialize, load_commands, #match, method_missing, options
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Debugger::Command
Class Method Details
.help(args) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/ruby-debug/commands/enable.rb', line 95
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 'enable' subcommand '#{args[1]}'."
end
end
s = %{
Enable some things.
This is used to cancel the effect of the "disable" command.
--
List of enable subcommands:
--
}
for subcmd in Subcommands do
s += "enable #{subcmd.name} -- #{subcmd.short_help}\n"
end
return s
end
|
.help_command ⇒ Object
91
92
93
|
# File 'lib/ruby-debug/commands/enable.rb', line 91
def help_command
'enable'
end
|
Instance Method Details
#enable_breakpoints(args) ⇒ Object
82
83
84
|
# File 'lib/ruby-debug/commands/enable.rb', line 82
def enable_breakpoints(args)
enable_disable_breakpoints("Enable", args)
end
|
#enable_display(args) ⇒ Object
86
87
88
|
# File 'lib/ruby-debug/commands/enable.rb', line 86
def enable_display(args)
enable_disable_display("Enable", args)
end
|
#execute ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/ruby-debug/commands/enable.rb', line 66
def execute
if not @match[1]
errmsg "\"enable\" 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("enable_#{subcmd.name}", args)
else
send("enable_breakpoints", args.unshift(param))
end
end
end
|
#regexp ⇒ Object
62
63
64
|
# File 'lib/ruby-debug/commands/enable.rb', line 62
def regexp
/^\s* en(?:able)? (?:\s+(.*))?$/ix
end
|