Class: Debugger::VarLocalCommand
- Defined in:
- lib/ruby-debug/commands/variables.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Command
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
140 141 142 143 144 |
# File 'lib/ruby-debug/commands/variables.rb', line 140 def help(cmd) %{ v[ar] l[ocal]\t\t\tshow local variables } end |
.help_command ⇒ Object
136 137 138 |
# File 'lib/ruby-debug/commands/variables.rb', line 136 def help_command 'var' end |
Instance Method Details
#execute ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 |
# 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) begin locals['self'] = _self unless _self.to_s == "main" 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 |
#regexp ⇒ Object
117 118 119 |
# File 'lib/ruby-debug/commands/variables.rb', line 117 def regexp /^\s*v(?:ar)?\s+l(?:ocal)?\s*$/ end |