Class: RSpecTelemetry::Trace::Viewer::Screen::TimelineScreen
- Inherits:
-
Object
- Object
- RSpecTelemetry::Trace::Viewer::Screen::TimelineScreen
- Defined in:
- lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb
Overview
Timeline-only state: filtering, folding, failure jumps, and live refresh.
Instance Method Summary collapse
- #activate ⇒ Object
- #count ⇒ Object
- #current_source ⇒ Object
- #detail_lines(width) ⇒ Object
- #draw_list(canvas, rect, focused:) ⇒ Object
- #handle_key_event(event, app) ⇒ Object
-
#initialize(document, list) ⇒ TimelineScreen
constructor
A new instance of TimelineScreen.
- #refresh ⇒ Object
- #source? ⇒ Boolean
- #time_bar? ⇒ Boolean
- #time_bar_current ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(document, list) ⇒ TimelineScreen
Returns a new instance of TimelineScreen.
17 18 19 20 21 22 23 24 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 17 def initialize(document, list) @document = document @list = list @filter = nil @collapsed = Set.new rebuild compute_durations end |
Instance Method Details
#activate ⇒ Object
31 32 33 34 35 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 31 def activate @collapsed.clear rebuild compute_durations end |
#count ⇒ Object
29 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 29 def count = @visible.size |
#current_source ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 62 def current_source entry = current_entry return entry.source if entry.is_a?(Document::Action) action = entry.is_a?(Document::Event) ? @document.action(entry.action) : nil action&.source end |
#detail_lines(width) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 55 def detail_lines(width) entry = current_entry children = entry.is_a?(Document::Action) ? @document.events_for(entry.seq) : [] duration = entry.is_a?(Document::Action) ? @durations[entry.seq] : nil DetailLines.for(entry, children: children, duration: duration, width: width) end |
#draw_list(canvas, rect, focused:) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 42 def draw_list(canvas, rect, focused:) TimelinePane .new( @visible, list: @list, focus: focused, collapsed: @collapsed, childful: @childful, durations: @durations ) .draw(canvas, rect) end |
#handle_key_event(event, app) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 77 def handle_key_event(event, app) case event.key when "/" open_filter(app) when "a" open_example_jump(app) when "n" jump_error(app, 1) when "N" jump_error(app, -1) when "\r" toggle_fold(app) when "z" toggle_all_folds(app) end end |
#refresh ⇒ Object
37 38 39 40 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 37 def refresh rebuild compute_durations end |
#source? ⇒ Boolean
28 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 28 def source? = @document.actions.any?(&:source) |
#time_bar? ⇒ Boolean
27 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 27 def = true |
#time_bar_current ⇒ Object
70 71 72 73 74 75 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 70 def entry = current_entry return nil if entry.nil? entry.is_a?(Document::Action) ? entry.wall_ms : entry.fields["wall_ms"] end |
#title ⇒ Object
26 |
# File 'lib/rspec_telemetry/trace/viewer/screen/timeline_screen.rb', line 26 def title = nil |