Class: Byebug::ContinueCommand

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

Overview

Implements the continue command.

Allows the user to continue execution until the next stopping point, a specific line number or until program termination.

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



34
35
36
37
38
# File 'lib/byebug/commands/continue.rb', line 34

def description
  %(c[ont[inue]][ <n>]

    Run until program ends, hits a breakpoint or reaches line <n>.)
end

.namesObject



30
31
32
# File 'lib/byebug/commands/continue.rb', line 30

def names
  %w(continue)
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/byebug/commands/continue.rb', line 13

def execute
  if @match[1]
    num, err = get_int(@match[1], 'Continue', 0, nil)
    return errmsg(err) unless num

    filename = File.expand_path(@state.file)
    unless LineCache.trace_line_numbers(filename).member?(num)
      return errmsg("Line #{num} is not a valid stopping point in file")
    end

    Breakpoint.add(filename, num)
  end

  @state.proceed
end

#regexpObject



9
10
11
# File 'lib/byebug/commands/continue.rb', line 9

def regexp
  /^\s* c(?:ont(?:inue)?)? (?:\s+(\S+))? \s*$/x
end