Class: Termplot::Widgets::StatisticsWidget

Inherits:
BaseWidget
  • Object
show all
Defined in:
lib/termplot/widgets/statistics_widget.rb

Instance Attribute Summary

Attributes inherited from BaseWidget

#bordered_window, #cols, #dataset, #decimals, #errors, #rows, #title, #window

Instance Method Summary collapse

Methods inherited from BaseWidget

#<<, #initialize, #post_initialize

Methods included from Renderable

#debug?, #render, #render_to_string

Constructor Details

This class inherits a constructor from Termplot::Widgets::BaseWidget

Instance Method Details

#render_to_windowObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/termplot/widgets/statistics_widget.rb', line 12

def render_to_window
  errors.clear
  window.clear
  window.cursor.reset_position

  render_statistics
  window.cursor.reset_position

  # Title bar
  Termplot::Renderers::TextRenderer.new(
    bordered_window: bordered_window,
    text: title,
    row: 0,
    align: :center,
    errors: errors
  ).render

  window.cursor.reset_position

  # Borders
  Termplot::Renderers::BorderRenderer.new(
    bordered_window: bordered_window
  ).render

  window.cursor.reset_position
end