Class: Debugger::VarConstantCommand

Inherits:
Command
  • Object
show all
Includes:
VarFunctions
Defined in:
lib/ruby-debug/commands/variables.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from VarFunctions

#var_list

Methods inherited from Command

commands, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



33
34
35
36
37
# File 'lib/ruby-debug/commands/variables.rb', line 33

def help(cmd)
  %{
    v[ar] c[onst] <object>\t\tshow constants of object
  }
end

.help_commandObject



29
30
31
# File 'lib/ruby-debug/commands/variables.rb', line 29

def help_command
  'var'
end

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
# File 'lib/ruby-debug/commands/variables.rb', line 19

def execute
  obj = debug_eval(@match.post_match)
  unless obj.kind_of? Module
    print "Should be Class/Module: %s\n", @match.post_match
  else
    var_list(obj.constants, obj.module_eval{binding()})
  end
end

#regexpObject



15
16
17
# File 'lib/ruby-debug/commands/variables.rb', line 15

def regexp
  /^\s*v(?:ar)?\s+c(?:onst(?:ant)?)?\s+/
end