Class: Byebug::QuitCommand

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

Overview

Implements byebug “quit” command

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

def description
  %{q[uit]|exit [!|unconditionally]\tExits 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



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

def names
  %w(quit exit)
end

Instance Method Details

#executeObject



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

def execute
  if @match[1] or confirm("Really quit? (y/n) ")
    @state.interface.finalize
    exit! # exit -> exit!: No graceful way to stop...
  end
end

#regexpObject



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

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