Class: Byebug::ThreadListCommand

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

Overview

List current threads.

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


98
99
100
101
102
# File 'lib/byebug/commands/threads.rb', line 98

def description
  prettify <<-EOD
    th[read] l[ist]  Lists all threads.
  EOD
end

.namesObject


94
95
96
# File 'lib/byebug/commands/threads.rb', line 94

def names
  %w(thread)
end

Instance Method Details

#executeObject


83
84
85
86
87
88
89
90
91
# File 'lib/byebug/commands/threads.rb', line 83

def execute
  contexts = Byebug.contexts.sort_by(&:thnum)

  thread_list = prc('thread.context', contexts) do |context, _|
    thread_arguments(context)
  end

  print(thread_list)
end

#regexpObject


79
80
81
# File 'lib/byebug/commands/threads.rb', line 79

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