Class: Byebug::ThreadSwitchCommand

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

Overview

Switch execution to a different 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


230
231
232
233
234
# File 'lib/byebug/commands/threads.rb', line 230

def description
  prettify <<-EOD
    th[read] sw[itch] <n>  Switches thread context to <n>.
  EOD
end

.namesObject


226
227
228
# File 'lib/byebug/commands/threads.rb', line 226

def names
  %w(thread)
end

Instance Method Details

#executeObject


215
216
217
218
219
220
221
222
223
# File 'lib/byebug/commands/threads.rb', line 215

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

  display_context(c)

  c.switch
  @state.proceed
end

#regexpObject


211
212
213
# File 'lib/byebug/commands/threads.rb', line 211

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