Class: Debugger::ListCommand

### Home Classes Methods

### In Files

- lib/ruby-debug/commands/list.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::ListCommand

Implements debugger "list" command.

### Public Class Methods

help(cmd) click to toggle source

    # File lib/ruby-debug/commands/list.rb, line 58
    def help(cmd)
      %{
        l[ist]\t\tlist forward
        l[ist] -\tlist backward
        l[ist] =\tlist current line
        l[ist] nn-mm\tlist given lines
        * NOTE - to turn on autolist, use 'set autolist'
      }
    end

help_command() click to toggle source

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

### Public Instance Methods

execute() click to toggle source

    # File lib/ruby-debug/commands/list.rb, line 19
    def execute
      listsize = Command.settings[:listsize]
      if !@match || !(@match[1] || @match[2])
        b = @state.previous_line ?
        @state.previous_line + listsize : @state.line - (listsize/2)
        e = b + listsize - 1
      elsif @match[1] == '-'
        b = if @state.previous_line
              if  @state.previous_line > 0
                @state.previous_line - listsize
              else
                @state.previous_line
              end
            else
              @state.line - (listsize/2)
            end
        e = b + listsize - 1
      elsif @match[1] == '='
        @state.previous_line = nil
        b = @state.line - (listsize/2)
        e = b + listsize -1
      else
        b, e = @match[2].split(/[-,]/)
        if e
          b = b.to_i
          e = e.to_i
        else
          b = b.to_i - (listsize/2)
          e = b + listsize - 1
        end
      end
      @state.previous_line = display_list(b, e, @state.file, @state.line)
    end

regexp() click to toggle source

    # File lib/ruby-debug/commands/list.rb, line 15
    def regexp
      /^\s* l(?:ist)? (?:\s*([-=])|\s+(.+))? $/
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.