Class: Byebug::ThreadStopCommand

Inherits:
Command
  • Object
show all
Includes:
ThreadFunctions
Defined in:
lib/byebug/commands/threads.rb

Overview

Stop execution of a thread.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ThreadFunctions

#display_context, #parse_thread_num, #parse_thread_num_for_cmd, #thread_arguments

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


159
160
161
162
163
# File 'lib/byebug/commands/threads.rb', line 159

def description
  prettify <<-EOD
    th[read] stop <n>  Stops thread <n>.
  EOD
end

.namesObject


155
156
157
# File 'lib/byebug/commands/threads.rb', line 155

def names
  %w(thread)
end

Instance Method Details

#executeObject


146
147
148
149
150
151
152
# File 'lib/byebug/commands/threads.rb', line 146

def execute
  c, err = parse_thread_num_for_cmd('thread stop', @match[1])
  return errmsg(err) if err

  c.suspend
  display_context(c)
end

#regexpObject


142
143
144
# File 'lib/byebug/commands/threads.rb', line 142

def regexp
  /^\s* th(?:read)? \s+ stop \s* (\S*) \s*$/x
end