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

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



193
194
195
196
197
# File 'lib/byebug/commands/variables.rb', line 193

def help(cmd)
  %{
    v[ar] ct\t\t\tshow class heirarchy of object
  }
end

.help_commandObject



189
190
191
# File 'lib/byebug/commands/variables.rb', line 189

def help_command
  'var'
end

Instance Method Details

#executeObject



174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/byebug/commands/variables.rb', line 174

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



170
171
172
# File 'lib/byebug/commands/variables.rb', line 170

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