Class: Audition::Progress::Log

Inherits:
Renderer
  • Object
show all
Defined in:
lib/audition/progress.rb

Overview

One completion line per phase. A log is the only trace a non-interactive run leaves, and a rewritten line would fill it with control characters.

Instance Method Summary collapse

Methods inherited from Renderer

#clear, #initialize, terminal?, #update

Constructor Details

This class inherits a constructor from Audition::Progress::Renderer

Instance Method Details

#item(progress) ⇒ Object

A unit worth naming is worth a line of its own, since nothing here rewrites what came before.



241
242
243
244
245
246
247
# File 'lib/audition/progress.rb', line 241

def item(progress)
  write(
    "#{paint("Audition", :bold)}: #{progress.label} " \
    "#{paint(progress.stage_label.to_s, :bold)} " \
    "#{paint("(#{fraction(progress)})", :dim)}\n"
  )
end

#phase_done(progress) ⇒ Object

Phases that walk the tree more than once report a duration and no count: each of their stage counts is a fraction of the work.



252
253
254
255
256
257
258
259
260
261
262
# File 'lib/audition/progress.rb', line 252

def phase_done(progress)
  total = progress.phase_total
  scanned = total ? ": #{commas(total)} #{progress.unit}" : ""
  count = progress.ractors
  on = count ? " on #{count} ractors" : ""
  write(
    "#{paint("Audition", :bold)}: " \
    "#{paint(progress.label, :bold)}#{scanned} in " \
    "#{paint(seconds(progress.phase_elapsed), :dim)}#{on}\n"
  )
end