Class: Byebug::VarInstanceCommand

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

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



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

def help(cmd)
  %{
    v[ar] i[nstance] <object>\tshow instance variables of object
  }
end

.help_commandObject



122
123
124
# File 'lib/byebug/commands/variables.rb', line 122

def help_command
  'var'
end

Instance Method Details

#executeObject



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

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

#regexpObject



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

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