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, help, 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 Byebug::Command

Class Method Details

.descriptionObject



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

def description
  %{
    v[ar] l[ocal]\t\t\tshow local variables
  }
end

.namesObject



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

def names
  %w(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