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

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

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

.namesObject



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

def names
  %w(var)
end

Instance Method Details

#executeObject



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

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



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

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