Class: Sprout::ProgressBarManager
- Inherits:
-
Object
- Object
- Sprout::ProgressBarManager
- Includes:
- Singleton
- Defined in:
- lib/sprout/progress_bar.rb
Overview
:nodoc:[all]
Instance Method Summary (collapse)
- - (Object) add(title, total1)
- - (Object) flush
-
- (ProgressBarManager) initialize
constructor
A new instance of ProgressBarManager.
- - (Object) outio
- - (Object) print(title)
Constructor Details
- (ProgressBarManager) initialize
A new instance of ProgressBarManager
299 300 301 302 303 |
# File 'lib/sprout/progress_bar.rb', line 299 def initialize @finished = {} @bars = {} @outs = {} end |
Instance Method Details
- (Object) add(title, total1)
305 306 307 308 309 310 311 |
# File 'lib/sprout/progress_bar.rb', line 305 def add(title, total1) # if(@bars[title]) # raise StandardError.new # end @outs[title] = ProgressBarOutputStream.new(self) @bars[title] = ProgressBarImpl.new(title, total1, @outs[title]) end |
- (Object) flush
325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/sprout/progress_bar.rb', line 325 def flush @bars.keys.each do |title| print(title) end @bars.values.each do || if(.finished?) print(.title) outio.print "\n" @outs.delete(.title) @bars.delete(.title) end end end |
- (Object) outio
321 322 323 |
# File 'lib/sprout/progress_bar.rb', line 321 def outio ProgressBar.outio end |
- (Object) print(title)
313 314 315 316 317 318 319 |
# File 'lib/sprout/progress_bar.rb', line 313 def print(title) str = '' str += @outs[title].to_s str += "\r" outio.print "\r" outio.print str end |