Class: Byebug::VarConstantCommand
- Inherits:
-
Command
- Object
- Command
- Byebug::VarConstantCommand
show all
- Defined in:
- lib/byebug/commands/variables.rb
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, #print_subcmds, register_setting_get, register_setting_set, register_setting_var, settings, settings_map
Class Method Details
.help(cmd) ⇒ Object
81
82
83
84
85
|
# File 'lib/byebug/commands/variables.rb', line 81
def help(cmd)
%{
v[ar] co[nst] <object>\t\tshow constants of object
}
end
|
.help_command ⇒ Object
77
78
79
|
# File 'lib/byebug/commands/variables.rb', line 77
def help_command
'var'
end
|
Instance Method Details
#execute ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/byebug/commands/variables.rb', line 61
def execute
obj = debug_eval(@match.post_match)
if obj.kind_of? Module
constants = debug_eval("#{@match.post_match}.constants")
constants.sort!
for c in constants
next if c =~ /SCRIPT/
value = obj.const_get(c) rescue "ERROR: #{$!}"
print " %s => %p\n", c, value
end
else
print "Should be Class/Module: %s\n", @match.post_match
end
end
|
#regexp ⇒ Object
57
58
59
|
# File 'lib/byebug/commands/variables.rb', line 57
def regexp
/^\s*v(?:ar)?\s+co(?:nst(?:ant)?)?\s+/
end
|