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



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

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

.help_commandObject



147
148
149
# File 'lib/ruby-debug/commands/variables.rb', line 147

def help_command
  'var'
end

Instance Method Details

#executeObject



138
139
140
141
142
143
144
# File 'lib/ruby-debug/commands/variables.rb', line 138

def execute
  locals = @state.context.frame_locals(@state.frame_pos)
  _self = @state.context.frame_self(@state.frame_pos) 
  locals.keys.sort.each do |name|
    print "  %s => %p\n", name, locals[name]
  end
end

#regexpObject



134
135
136
# File 'lib/ruby-debug/commands/variables.rb', line 134

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