Class: Byebug::VarInstanceCommand

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

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



120
121
122
# File 'lib/byebug/commands/variables.rb', line 120

def description
  %{v[ar] i[nstance] <object>\tshow instance variables of object}
end

.namesObject



116
117
118
# File 'lib/byebug/commands/variables.rb', line 116

def names
  %w(var)
end

Instance Method Details

#executeObject



110
111
112
113
# File 'lib/byebug/commands/variables.rb', line 110

def execute
  obj = bb_eval(@match.post_match.empty? ? 'self' : @match.post_match)
  var_list(obj.instance_variables, obj.instance_eval{binding()})
end

#regexpObject



106
107
108
# File 'lib/byebug/commands/variables.rb', line 106

def regexp
  /^\s* v(?:ar)? \s+ ins(?:tance)? \s*/x
end