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



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

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

.help_commandObject



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

def help_command
  'var'
end

Instance Method Details

#executeObject



121
122
123
124
125
126
127
128
# File 'lib/ruby-debug/commands/variables.rb', line 121

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



117
118
119
# File 'lib/ruby-debug/commands/variables.rb', line 117

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