9 changed files with 96 additions and 35 deletions
@ -0,0 +1,24 @@ |
|||||||
|
require 'ruby-progressbar' |
||||||
|
|
||||||
|
module Squib |
||||||
|
# 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 |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
end |
||||||
|
end |
||||||
@ -1 +1,3 @@ |
|||||||
dpi: 300 |
dpi: 300 |
||||||
|
progress_bar: true |
||||||
|
hint: '#FF0000' |
||||||
Loading…
Reference in new issue