Class: Onair::Renderer::Tty
- Inherits:
-
Object
- Object
- Onair::Renderer::Tty
- Defined in:
- lib/onair/renderer/tty.rb
Overview
Pure function of Report + flags: no IO, snapshot-testable.
Constant Summary collapse
- COLORS =
{ bold: "\e[1m", green: "\e[0;32m", yellow: "\e[1;33m", dim: "\e[2m", purple: "\e[38;5;176m", cyan: "\e[0;36m", reset: "\e[0m" }.freeze
- NOT_FOUND_SUBJECT =
"(commit not found in local git)"
Instance Method Summary collapse
-
#initialize(report:, app:, platform_label:, branch:, repo:, color:, hyperlinks:, now:, task: nil) ⇒ Tty
constructor
A new instance of Tty.
- #render ⇒ Object
Constructor Details
#initialize(report:, app:, platform_label:, branch:, repo:, color:, hyperlinks:, now:, task: nil) ⇒ Tty
Returns a new instance of Tty.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/onair/renderer/tty.rb', line 19 def initialize(report:, app:, platform_label:, branch:, repo:, color:, hyperlinks:, now:, task: nil) @report = report @app = app @platform_label = platform_label @branch = branch @repo = repo @color = color @hyperlinks = hyperlinks @now = now @task = task end |
Instance Method Details
#render ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/onair/renderer/tty.rb', line 31 def render lines = ["", " #{code(:purple)}#{@platform_label} #{code(:bold)}#{@app}#{code(:reset)}", ""] lines.concat(pending_lines) lines.concat(deployed_lines) lines << "" "#{lines.join("\n")}\n" end |