Class: Byebug::VarInheritCommand

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

Overview

Implements byebug’s ‘var inherit’ command

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

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, method_missing, options, 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



183
184
185
# File 'lib/byebug/commands/variables.rb', line 183

def description
  %{v[ar] ct\t\t\tshow class heirarchy of object}
end

.namesObject



179
180
181
# File 'lib/byebug/commands/variables.rb', line 179

def names
  %w(var)
end

Instance Method Details

#executeObject



164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/byebug/commands/variables.rb', line 164

def execute
  unless @state.context
    errmsg "can't get object inheritance.\n"
    return
  end
  puts @match.post_match
  obj = debug_eval("#{@match.post_match}.classtree")
  if obj
    print obj
  else
    errmsg "Trouble getting object #{@match.post_match}\n"
  end
end

#regexpObject



160
161
162
# File 'lib/byebug/commands/variables.rb', line 160

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