Class: Byebug::ContinueCommand

Inherits:
Command
  • Object
show all
Includes:
Helpers::ParseHelper
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.

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::ParseHelper

#get_int, #parse_steps, #syntax_valid?

Methods inherited from Command

#arguments, columnize, #context, #frame, help, #initialize, match, to_s

Methods included from Helpers::StringHelper

#camelize, #deindent, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/byebug/commands/continue.rb', line 20

def self.description
  <<-DESCRIPTION
    c[ont[inue]][ <line_number>]

    #{short_description}

    Normally the program stops at the next breakpoint. However, if the
    parameter "unconditionally" is given or the command is suffixed with
    "!", the program will run until the end regardless of any enabled
    breakpoints.
  DESCRIPTION
end

.regexpObject



16
17
18
# File 'lib/byebug/commands/continue.rb', line 16

def self.regexp
  /^\s* c(?:ont(?:inue)?)? (?:(!|\s+unconditionally|\s+\S+))? \s*$/x
end

.short_descriptionObject



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

def self.short_description
  "Runs until program ends, hits a breakpoint or reaches a line"
end

Instance Method Details

#executeObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/byebug/commands/continue.rb', line 37

def execute
  if until_line?
    num, err = get_int(modifier, "Continue", 0, nil)
    return errmsg(err) unless num

    filename = File.expand_path(frame.file)
    return errmsg(pr("continue.errors.unstopped_line", line: num)) unless Breakpoint.potential_line?(filename, num)

    Breakpoint.add(filename, num)
  end

  processor.proceed!

  Byebug.mode = :off if unconditionally?
  Byebug.stop if unconditionally? || Byebug.stoppable?
end