Class: RubyJard::Screens::ThreadsScreen

Inherits:
RubyJard::Screen show all
Defined in:
lib/ruby_jard/screens/threads_screen.rb

Overview

Display all current alive threads, excluding internal threads

Instance Attribute Summary

Attributes inherited from RubyJard::Screen

#cursor, #layout, #rows, #selected, #window

Instance Method Summary collapse

Methods inherited from RubyJard::Screen

#click, #move_down, #move_up, #page_down, #page_up

Constructor Details

#initialize(*args) ⇒ ThreadsScreen

Returns a new instance of ThreadsScreen.



8
9
10
11
12
13
14
15
16
# File 'lib/ruby_jard/screens/threads_screen.rb', line 8

def initialize(*args)
  super
  @current_frame_location = @session.current_frame&.frame_location
  @current_thread = @session.current_thread
  @threads = @session.threads

  @selected = @threads.index { |c| current_thread?(c) }
  @path_decorator = RubyJard::Decorators::PathDecorator.new
end

Instance Method Details

#buildObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ruby_jard/screens/threads_screen.rb', line 22

def build
  threads = sort_threads(@threads)
  @rows = threads.map do |thread|
    RubyJard::Row.new(
      line_limit: 2,
      columns: [
        RubyJard::Column.new(
          spans: [
            span_mark(thread),
            span_thread_label(thread)
          ]
        ),
        RubyJard::Column.new(
          spans: [
            span_thread_status(thread)
          ]
        ),
        RubyJard::Column.new(
          spans: [
            span_thread_name(thread),
            span_thread_location(thread)
          ]
        )
      ]
    )
  end
end

#titleObject



18
19
20
# File 'lib/ruby_jard/screens/threads_screen.rb', line 18

def title
  ['Threads', "#{@threads.length} threads"]
end