Class: Debugger::VarConstantCommand
- Inherits:
-
Command
- Object
- Command
- Debugger::VarConstantCommand
show all
- Defined in:
- lib/ruby-debug/commands/variables.rb
Overview
Constant Summary
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, register_setting_get, register_setting_set, register_setting_var, settings, settings_map
Class Method Details
.help(cmd) ⇒ Object
80
81
82
83
84
|
# File 'lib/ruby-debug/commands/variables.rb', line 80
def help(cmd)
%{
v[ar] co[nst] <object>\t\tshow constants of object
}
end
|
.help_command ⇒ Object
76
77
78
|
# File 'lib/ruby-debug/commands/variables.rb', line 76
def help_command
'var'
end
|
Instance Method Details
#execute ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/ruby-debug/commands/variables.rb', line 62
def execute
obj = debug_eval(@match.post_match)
if obj.kind_of? Module
constants = debug_eval("#{@match.post_match}.constants").sort.reject { |c| c =~ /SCRIPT/ }.map do |constant|
value = obj.const_get(constant) rescue "ERROR: #{$!}"
[constant, value]
end
print prv(constants, "constant")
else
errmsg pr("variable.errors.not_class_module", object: @match.post_match)
end
end
|
#regexp ⇒ Object
58
59
60
|
# File 'lib/ruby-debug/commands/variables.rb', line 58
def regexp
/^\s*v(?:ar)?\s+co(?:nst(?:ant)?)?\s+/
end
|