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, #match

Methods included from StringFunctions

#camelize, #prettify

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Methods included from ParseFunctions

#get_int, #parse_steps, #syntax_valid?

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



36
37
38
39
40
41
42
# File 'lib/byebug/commands/continue.rb', line 36

def description
  prettify <<-EOD
    c[ont[inue]][ <n>]

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

.namesObject



32
33
34
# File 'lib/byebug/commands/continue.rb', line 32

def names
  %w(continue)
end

Instance Method Details

#executeObject



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

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 Breakpoint.potential_line?(filename, num)
      return errmsg(pr('continue.errors.unstopped_line', line: num))
    end

    Breakpoint.add(filename, num)
  end

  @state.proceed
end

#regexpObject



11
12
13
# File 'lib/byebug/commands/continue.rb', line 11

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