Class: RSpecTelemetry::Trace::Viewer::DetailPane

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_telemetry/trace/viewer/detail_pane.rb

Instance Method Summary collapse

Constructor Details

#initialize(lines, scroll:) ⇒ DetailPane

Returns a new instance of DetailPane.



9
10
11
12
# File 'lib/rspec_telemetry/trace/viewer/detail_pane.rb', line 9

def initialize(lines, scroll:)
  @lines = lines
  @scroll = scroll
end

Instance Method Details

#draw(canvas, rect) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/rspec_telemetry/trace/viewer/detail_pane.rb', line 16

def draw(canvas, rect)
  TuiTui::TextView.draw(canvas, rect, top: @scroll, scrollbar: Theme.base, total: @lines.length) do |index|
    line = @lines[index]
    next nil if line.nil?

    style = index.zero? ? Theme.style(:action) : Theme.style(:dim)
    TuiTui::Line[TuiTui::Span[line, style]]
  end
end

#lengthObject



14
# File 'lib/rspec_telemetry/trace/viewer/detail_pane.rb', line 14

def length = @lines.length