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

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



18
19
20
21
22
23
24
# File 'lib/byebug/commands/continue.rb', line 18

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

    #{short_description}
  EOD
end

.regexpObject



14
15
16
# File 'lib/byebug/commands/continue.rb', line 14

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

.short_descriptionObject



26
27
28
# File 'lib/byebug/commands/continue.rb', line 26

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

Instance Method Details

#executeObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/byebug/commands/continue.rb', line 30

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

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

    Breakpoint.add(filename, num)
  end

  processor.proceed!

  Byebug.stop if Byebug.stoppable?
end