Sha256: 885f010f7d22c5bc8c4b3fa2e40560996b8875faf2adb481e76b0339e5ecceb8

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'

$LOAD_PATH.unshift File.dirname(__FILE__)+"/../lib"
require 'multi_progress_bar'


begin
  MultiProgressBar.start

  # Demo.
  make_machine_bar = lambda { MultiProgressBar::Bar.new("(Waiting...)", 0) }
  machine_bars = [make_machine_bar[], make_machine_bar[]]
  total = MultiProgressBar::TotalBar.new("-Total-")

  machine_names = ["bleeker", "montrose"]

  until false #machine_bars.all? { |bar| bar.title != "(Waiting...)" && bar.current == bar.total }
    sleep(0.1)

    # Simulate machines becoming available.
    machine_bars.each do |bar|
      if bar.title == "(Waiting...)"
        bar.title = machine_names.pop if rand(10) == 0
        bar.total = 100
      else
        bar.inc(rand(10))
      end
    end

#    MultiProgressBar.log(rand(2000))
  end
ensure
  MultiProgressBar.end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_progress_bar-0.3.0 examples/example.rb