Class: Byebug::VarLocalCommand

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

Overview

Implements byebug’s ‘var local’ command

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



145
146
147
# File 'lib/byebug/commands/variables.rb', line 145

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

.namesObject



141
142
143
# File 'lib/byebug/commands/variables.rb', line 141

def names
  %w(var)
end

Instance Method Details

#executeObject



132
133
134
135
136
137
138
# File 'lib/byebug/commands/variables.rb', line 132

def execute
  _self = @state.context.frame_self(@state.frame_pos)
  locals = @state.context.frame_locals
  locals.keys.sort.each do |name|
    print "  %s => %p\n", name, locals[name]
  end
end

#regexpObject



128
129
130
# File 'lib/byebug/commands/variables.rb', line 128

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