Class: Debugger::MethodCommand

### Home Classes Methods

### In Files

- lib/ruby-debug/commands/method.rb

### Parent

Debugger::Command

### Methods

- ::help
- ::help_command
- #execute
- #regexp

### Class/Module Index

Quicksearch

- Debugger
- Debugger::AddBreakpoint
- Debugger::Breakpoint
- Debugger::Context
- Debugger::ContinueCommand
- Debugger::DeleteBreakpointCommand
- Debugger::FinishCommand
- Debugger::HelpCommand
- Debugger::IRBCommand
- Debugger::InfoCommand
- Debugger::JumpCommand
- Debugger::KillCommand
- Debugger::ListCommand
- Debugger::LocalInterface
- Debugger::LocalInterface::Debugger
- Debugger::MethodCommand
- Debugger::MethodSigCommand
- Debugger::NextCommand
- Debugger::ParseFunctions
- Debugger::Processor
- Debugger::QuitCommand
- Debugger::ReloadCommand
- Debugger::SetCommand
- Debugger::ShowCommand
- Debugger::SkipCommand
- Debugger::SourceCommand
- Debugger::StepCommand
- Debugger::VarClassVarCommand
- Debugger::VarInheritCommand
- Debugger::VarLocalCommand
- Debugger::WhereCommand
- Printers
- Printers::Base
- Printers::Base::MissedArgument
- Printers::Base::MissedPath
- Printers::Plain
- Mocha
- Mocha::Call
- Mocha::Expectation
- Mocha::Mock
- MiniTest
- MiniTest::Assertions
- MiniTest::Expectations
- TestDsl
- TestDsl::ClassMethods
- TestDsl::Shared
- Kernel
- Module
- PrinterHelpers
- TestInterface

No matching classes.

# Debugger::MethodCommand

Implements the debugger 'method' command.

### Public Class Methods

help(cmd) click to toggle source

    # File lib/ruby-debug/commands/method.rb, line 71
    def help(cmd)
      %{
        m[ethod] i[nstance] <obj>\tshow methods of object
        m[ethod] iv <obj>\t\tshow instance variables of object
        m[ethod] <class|module>\t\tshow instance methods of class or module
      }
    end

help_command() click to toggle source

    # File lib/ruby-debug/commands/method.rb, line 67
    def help_command
      'method'
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/ruby-debug/commands/method.rb, line 48
    def execute
      result = if @match[1] == "iv"
        obj = debug_eval(@match.post_match)
        variables = obj.instance_variables.sort.map { |var_name| [var_name, obj.instance_variable_get(var_name)] }
        prv(variables, 'instance')
      elsif @match[1]
        prc("method.methods", debug_eval(@match.post_match).methods.sort) { |item, _| {name: item} }
      else
        obj = debug_eval(@match.post_match)
        if obj.kind_of?(Module)
          prc("method.methods", obj.instance_methods(false).sort) { |item, _| {name: item} }
        else
          errmsg(pr("variable.errors.not_class_module", object: @match.post_match)) && return
        end
      end
      print result
    end

regexp() click to toggle source

    # File lib/ruby-debug/commands/method.rb, line 44
    def regexp
      /^\s*m(?:ethod)?\s+((iv)|(i(:?nstance)?)\s+)?/
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.