Class: FunCi::Tui::BoardRenderer
- Inherits:
-
Object
- Object
- FunCi::Tui::BoardRenderer
- Defined in:
- lib/fun_ci/tui/board_renderer.rb
Constant Summary collapse
- HEADER_HEIGHT =
HeaderAnimationManager::HEADER_HEIGHT
Instance Method Summary collapse
- #animation_renderer? ⇒ Boolean
- #begin_frame ⇒ Object
- #clear ⇒ Object
-
#initialize(screen:, spinner:, animation_renderer:, height_provider:) ⇒ BoardRenderer
constructor
A new instance of BoardRenderer.
- #render(runs:, streak:, cursor_index:, confirming:) ⇒ Object
- #resize(new_width) ⇒ Object
Constructor Details
#initialize(screen:, spinner:, animation_renderer:, height_provider:) ⇒ BoardRenderer
Returns a new instance of BoardRenderer.
12 13 14 15 16 17 |
# File 'lib/fun_ci/tui/board_renderer.rb', line 12 def initialize(screen:, spinner:, animation_renderer:, height_provider:) @screen = screen @spinner = spinner @animation_renderer = animation_renderer @height_provider = height_provider end |
Instance Method Details
#animation_renderer? ⇒ Boolean
51 52 53 |
# File 'lib/fun_ci/tui/board_renderer.rb', line 51 def animation_renderer? !!@animation_renderer end |
#begin_frame ⇒ Object
38 39 40 41 |
# File 'lib/fun_ci/tui/board_renderer.rb', line 38 def begin_frame @screen.move_cursor_home @spinner.advance! end |
#clear ⇒ Object
43 44 45 |
# File 'lib/fun_ci/tui/board_renderer.rb', line 43 def clear @screen.clear end |
#render(runs:, streak:, cursor_index:, confirming:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fun_ci/tui/board_renderer.rb', line 19 def render(runs:, streak:, cursor_index:, confirming:) update_height render_header_area(runs, streak) if runs.empty? @screen.render_empty_state @screen.(empty: true) else rows = runs.map { |run| format_run(run) } rows = truncate_rows_to_height(rows) @screen.render_board(rows, cursor_index: cursor_index) @screen.println unless rows.empty? @screen.(empty: false, confirming: confirming) end @screen.clear_below render_animations(runs) end |
#resize(new_width) ⇒ Object
47 48 49 |
# File 'lib/fun_ci/tui/board_renderer.rb', line 47 def resize(new_width) @screen.width = new_width end |