class Squib::Progress

A facade that handles (or doesn’t) the progress bar on the console

@api private

Attributes

enabled[RW]

Public Class Methods

new(enabled) click to toggle source
# File lib/squib/progress.rb, line 22
def initialize(enabled)
  @enabled = enabled
end

Public Instance Methods

start(title='', total=100) { |bar| ... } click to toggle source
# File lib/squib/progress.rb, line 26
def start(title='', total=100, &block)
  if @enabled
    @bar = ProgressBar.create(title: title, total: total, format: '%t <%B> %p%% %a')
    yield(@bar)
    @bar.finish
  else
    yield(Squib::DoNothing.new)
  end
end