Class: SorbetProgress::Reporters::BarChart

Inherits:
Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/sorbet_progress/reporters/bar_chart.rb

Overview

Produces output something like this:

“‘ Sorbet progress: ignore | false | true | strict+ |—————-50————–|———25——–|-5-|——20——| Keep up the good work 👍 “`

The chart is colored. Colorless terminals are not supported.

Strict and strong are combined into one category because strong is not a reachable goal in most projects.

Constant Summary collapse

COLORS =
T.let(%w[red yellow green blue].freeze, T::Array[String])
LENGTH =
80

Instance Method Summary collapse

Constructor Details

#initialize(calculator) ⇒ BarChart

Returns a new instance of BarChart.



28
29
30
# File 'lib/sorbet_progress/reporters/bar_chart.rb', line 28

def initialize(calculator)
  @calculator = calculator
end

Instance Method Details

#reportObject



33
34
35
36
37
38
39
# File 'lib/sorbet_progress/reporters/bar_chart.rb', line 33

def report
  [
    "Sorbet progress: ignore | false | true | strict+",
    bar_chart,
    "Keep up the good work 👍"
  ].flatten.join("\n")
end