Class: Byebug::ThreadSwitchCommand

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

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



199
200
201
# File 'lib/byebug/commands/threads.rb', line 199

def description
  %{th[read] [sw[itch]] <nnn>\tswitch thread context to nnn}
end

.namesObject



195
196
197
# File 'lib/byebug/commands/threads.rb', line 195

def names
  %w(thread)
end

Instance Method Details

#executeObject



181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/byebug/commands/threads.rb', line 181

def execute
  if @match[1] =~ /switch/
    errmsg '"thread switch" needs a thread number'
    return
  end
  c = parse_thread_num_for_cmd('thread switch', @match[1])
  return unless c
  display_context(c)
  c.step_into 1
  c.thread.run
  @state.proceed
end

#regexpObject



177
178
179
# File 'lib/byebug/commands/threads.rb', line 177

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