Class: Byebug::ThreadSwitchCommand

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

Overview

Thread switch Must come after “Thread resume” because “switch” is optional

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, #print_subcmds, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.help(cmd) ⇒ Object



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

def help(cmd)
  %{
    th[read] [sw[itch]] <nnn>\tswitch thread context to nnn
  }
end

.help_commandObject



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

def help_command
  'thread'
end

Instance Method Details

#executeObject



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

def execute
  c = parse_thread_num_for_cmd("thread switch", @match[1])
  return unless c
  display_context(c)
  c.stop_next = 1
  c.thread.run
  @state.proceed
end

#regexpObject



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

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