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

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



24
25
26
27
28
29
30
# File 'lib/byebug/commands/quit.rb', line 24

def description
  %(q[uit]|exit [!|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.)
end

.namesObject



20
21
22
# File 'lib/byebug/commands/quit.rb', line 20

def names
  %w(quit exit)
end

Instance Method Details

#executeObject



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

def execute
  return unless @match[1] || confirm('Really quit? (y/n) ')

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

#regexpObject



8
9
10
# File 'lib/byebug/commands/quit.rb', line 8

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