Sha256: 90f6420735fd11665e17b088ca59ac55a629644967939e7c0c6f9cf0086462ad
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
require 'ruby-progressbar' module Squib # :nodoc: # @api private class DoNothing def increment end def finish end end # A facade that handles (or doesn't) the progress bar on the console # # :nodoc: # @api private class Progress attr_accessor :enabled def initialize(enabled) @enabled = enabled end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
squib-0.0.3 | lib/squib/progress.rb |