Class: Byebug::QuitCommand

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

Overview

Exit from byebug.

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

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



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/byebug/commands/quit.rb', line 17

def self.description
  <<-DESCRIPTION
    q[uit][!| unconditionally]

    #{short_description}

    Normally we prompt before exiting. However, if the parameter
    "unconditionally" is given or command is suffixed with "!", we exit
    without asking further questions.
  DESCRIPTION
end

.regexpObject



13
14
15
# File 'lib/byebug/commands/quit.rb', line 13

def self.regexp
  /^\s* q(?:uit)? \s* (?:(!|\s+unconditionally))? \s*$/x
end

.short_descriptionObject



29
30
31
# File 'lib/byebug/commands/quit.rb', line 29

def self.short_description
  "Exits byebug"
end

Instance Method Details

#executeObject



33
34
35
36
37
38
39
40
# File 'lib/byebug/commands/quit.rb', line 33

def execute
  return unless @match[1] || confirm(pr("quit.confirmations.really"))

  processor.interface.autosave
  processor.interface.close

  Process.exit!
end