Class: Byebug::VarConstantCommand
- Inherits:
-
Command
- Object
- Command
- Byebug::VarConstantCommand
show all
- Defined in:
- lib/byebug/commands/variables.rb
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
Class Method Details
.description ⇒ Object
79
80
81
|
# File 'lib/byebug/commands/variables.rb', line 79
def description
%{v[ar] co[nst] <object>\t\tshow constants of object}
end
|
.names ⇒ Object
75
76
77
|
# File 'lib/byebug/commands/variables.rb', line 75
def names
%w(var)
end
|
Instance Method Details
#execute ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/byebug/commands/variables.rb', line 59
def execute
obj = bb_eval(@match.post_match)
if obj.kind_of? Module
constants = bb_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: #{@match.post_match}\n"
end
end
|
#regexp ⇒ Object
55
56
57
|
# File 'lib/byebug/commands/variables.rb', line 55
def regexp
/^\s* v(?:ar)? \s+ co(?:nst(?:ant)?)? \s+/x
end
|