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

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



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

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

.namesObject



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

def names
  %w(var)
end

Instance Method Details

#executeObject



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

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

#regexpObject



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

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