Class: Debugger::VarLocalCommand

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



129
130
131
132
133
# File 'lib/ruby-debug/commands/variables.rb', line 129

def help(cmd)
  %{
    v[ar] l[ocal]\t\t\tshow local variables
  }
end

.help_commandObject



125
126
127
# File 'lib/ruby-debug/commands/variables.rb', line 125

def help_command
  'var'
end

Instance Method Details

#executeObject



115
116
117
118
119
120
121
122
# File 'lib/ruby-debug/commands/variables.rb', line 115

def execute
  locals = @state.context.frame_locals(@state.frame_pos)
  _self = @state.context.frame_self(@state.frame_pos) 
  locals['self'] = _self unless _self.to_s == "main"
  print_variables(locals.keys, 'local') do |var|
    locals[var]
  end
end

#regexpObject



111
112
113
# File 'lib/ruby-debug/commands/variables.rb', line 111

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