Class: Audition::Progress::Renderer
- Inherits:
-
Object
- Object
- Audition::Progress::Renderer
- Defined in:
- lib/audition/progress.rb
Overview
Shared by the renderers: both write to a stream that may go away, both spell out counts and durations the same way, and both paint with the palette the report uses.
Class Method Summary collapse
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(io, style: nil) ⇒ Renderer
constructor
A new instance of Renderer.
-
#item(progress) ⇒ Object
A named unit is still just progress unless the renderer has a reason to treat it differently.
- #phase_done(progress) ⇒ Object
- #update(progress) ⇒ Object
Constructor Details
#initialize(io, style: nil) ⇒ Renderer
Returns a new instance of Renderer.
26 27 28 29 30 |
# File 'lib/audition/progress.rb', line 26 def initialize(io, style: nil) @io = io @style = style || Report::Style.detect(io: io) @live = true end |
Class Method Details
.terminal?(io) ⇒ Boolean
17 18 19 20 21 |
# File 'lib/audition/progress.rb', line 17 def self.terminal?(io) io.respond_to?(:tty?) && io.tty? rescue IOError false end |
Instance Method Details
#clear ⇒ Object
40 |
# File 'lib/audition/progress.rb', line 40 def clear = nil |
#item(progress) ⇒ Object
A named unit is still just progress unless the renderer has a reason to treat it differently.
36 |
# File 'lib/audition/progress.rb', line 36 def item(progress) = update(progress) |
#phase_done(progress) ⇒ Object
38 |
# File 'lib/audition/progress.rb', line 38 def phase_done(progress) = nil |
#update(progress) ⇒ Object
32 |
# File 'lib/audition/progress.rb', line 32 def update(progress) = nil |