Class: Debugger::VarLocalCommand

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

Overview

Implements the debugger ‘var local’ command.

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, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



168
169
170
171
172
# File 'lib/ruby-debug/commands/variables.rb', line 168

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

.help_commandObject



164
165
166
# File 'lib/ruby-debug/commands/variables.rb', line 164

def help_command
  'var'
end

Instance Method Details

#executeObject



155
156
157
158
159
160
161
# File 'lib/ruby-debug/commands/variables.rb', line 155

def execute
  locals = []
  _self = @state.context.frame_self(@state.frame_pos)
  locals << ['self', _self] unless _self.to_s == "main"
  locals += @state.context.frame_locals(@state.frame_pos).sort.map { |key, value| [key, value] }
  print prv(locals, 'instance')
end

#regexpObject



151
152
153
# File 'lib/ruby-debug/commands/variables.rb', line 151

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