Class: Byebug::QuitCommand

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

Overview

Exit from byebug.

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


27
28
29
30
31
32
33
34
35
# File 'lib/byebug/commands/quit.rb', line 27

def description
  prettify <<-EOD
    q[uit] [!|unconditionally] Exits from byebug.

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

.namesObject


23
24
25
# File 'lib/byebug/commands/quit.rb', line 23

def names
  %w(quit)
end

Instance Method Details

#executeObject


14
15
16
17
18
19
20
# File 'lib/byebug/commands/quit.rb', line 14

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

  @state.interface.autosave
  @state.interface.close
  exit! # exit -> exit!: No graceful way to stop...
end

#regexpObject


10
11
12
# File 'lib/byebug/commands/quit.rb', line 10

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