Class: Byebug::QuitCommand

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

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



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

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



17
18
19
# File 'lib/byebug/commands/quit.rb', line 17

def names
  %w(quit exit)
end

Instance Method Details

#executeObject



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

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

#regexpObject



5
6
7
# File 'lib/byebug/commands/quit.rb', line 5

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