Class: Legion::CLI::Dashboard::Renderer
- Inherits:
-
Object
- Object
- Legion::CLI::Dashboard::Renderer
- Defined in:
- lib/legion/cli/dashboard/renderer.rb
Instance Method Summary collapse
-
#initialize(width: nil) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(data) ⇒ Object
Constructor Details
#initialize(width: nil) ⇒ Renderer
Returns a new instance of Renderer.
7 8 9 |
# File 'lib/legion/cli/dashboard/renderer.rb', line 7 def initialize(width: nil) @width = width || default_width end |
Instance Method Details
#render(data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/legion/cli/dashboard/renderer.rb', line 11 def render(data) lines = [] lines << header_line(data) lines << separator lines << workers_section(data[:workers] || []) lines << separator lines << events_section(data[:events] || []) lines << separator lines << health_section(data[:health] || {}) lines << separator lines << org_chart_section(data[:departments] || []) lines << (data[:fetched_at]) lines.flatten.join("\n") end |