Class: Byebug::VarLocalCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/variables.rb

Overview

Implements byebug’s ‘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, #print_subcmds, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.help(cmd) ⇒ Object



153
154
155
156
157
# File 'lib/byebug/commands/variables.rb', line 153

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

.help_commandObject



149
150
151
# File 'lib/byebug/commands/variables.rb', line 149

def help_command
  'var'
end

Instance Method Details

#executeObject



140
141
142
143
144
145
146
# File 'lib/byebug/commands/variables.rb', line 140

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



136
137
138
# File 'lib/byebug/commands/variables.rb', line 136

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