Class: Debugger::VarGlobalCommand

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



53
54
55
56
57
# File 'lib/ruby-debug/commands/variables.rb', line 53

def help(cmd)
  %{
    v[ar] g[lobal]\t\t\tshow global variables
  }
end

.help_commandObject



49
50
51
# File 'lib/ruby-debug/commands/variables.rb', line 49

def help_command
  'var'
end

Instance Method Details

#executeObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ruby-debug/commands/variables.rb', line 36

def execute
  globals = []
  if RUBY_VERSION < "1.9"
    globals = global_variables
  else
    Debugger::without_stderr { globals = global_variables - [:$KCODE, :$=] }
  end
  print_variables(globals, 'global') do |var|
    debug_eval(var)
  end
end

#regexpObject



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

def regexp
  /^\s*v(?:ar)?\s+g(?:lobal)?\s*$/
end