Class: Debugger::VarConstantCommand

Inherits:
Command
  • Object
show all
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 inherited from Command

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

Constructor Details

This class inherits a constructor from Debugger::Command

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



23
24
25
26
27
# File 'lib/ruby-debug/commands/variables.rb', line 23

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

.help_commandObject



19
20
21
# File 'lib/ruby-debug/commands/variables.rb', line 19

def help_command
  'var'
end

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby-debug/commands/variables.rb', line 7

def execute
  obj = debug_eval(@match.post_match)
  unless obj.kind_of? Module
    print_msg "Should be Class/Module: %s", @match.post_match
  else
    print_variables(obj.constants, "constant") do |var|
      obj.const_get(var)
    end
  end
end

#regexpObject



3
4
5
# File 'lib/ruby-debug/commands/variables.rb', line 3

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