Class: Debugger::VarLocalCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug-ide/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, file_filter_supported?, #find, inherited, #initialize, load_commands, #match, method_missing, options, unescape_incoming

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



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

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

.help_commandObject



143
144
145
# File 'lib/ruby-debug-ide/commands/variables.rb', line 143

def help_command
  'var'
end

Instance Method Details

#executeObject



128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/ruby-debug-ide/commands/variables.rb', line 128

def execute
  locals = @state.context.frame_locals(@state.frame_pos)
  _self = @state.context.frame_self(@state.frame_pos)
  begin
    locals['self'] = _self unless TOPLEVEL_BINDING.eval('self') == _self
  rescue => ex
    locals['self'] = "<Cannot evaluate self>"
    $stderr << "Cannot evaluate self\n#{ex.class.name}: #{ex.message}\n  #{ex.backtrace.join("\n  ")}"
  end
  print_variables(locals.keys, 'local') do |var|
    locals[var]
  end
end

#regexpObject



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

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