Class: TTY::ProgressBar::Formatters

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/tty/progressbar/formatters.rb

Instance Method Summary collapse

Constructor Details

#initialize(pipeline = nil) ⇒ Formatters

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Formatters.



29
30
31
# File 'lib/tty/progressbar/formatters.rb', line 29

def initialize(pipeline = nil)
  @pipeline = pipeline || TTY::ProgressBar::Pipeline.new
end

Instance Method Details

#load(progress) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Prepare default pipeline formatters



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tty/progressbar/formatters.rb', line 36

def load(progress)
  @pipeline.use TTY::ProgressBar::CurrentFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::TotalFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::TotalByteFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::ElapsedFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::EstimatedTimeFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::EstimatedFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::PercentFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::ByteFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::ByteRateFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::RateFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::MeanRateFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::MeanByteFormatter.new(progress)
  @pipeline.use TTY::ProgressBar::BarFormatter.new(progress)
end