class Pork::Progressbar::Bar

Attributes

thread[RW]

Public Class Methods

new(reporter, *args) click to toggle source
Calls superclass method
# File lib/pork/report/progressbar.rb, line 38
def initialize reporter, *args
  super(*args)

  # don't print extra newline
  output.extend(CarriageReturn)

  # colourize the bar
  @format.molecules.each do |m|
    m.extend(Painter)
    m.reporter = reporter
  end

  # set FPS to 30
  self.thread = Thread.new do
    until finished?
      sleep(0.033)
      update_progress(:itself)
    end
  end
end

Public Instance Methods

raise(size) click to toggle source
# File lib/pork/report/progressbar.rb, line 64
def raise size
  progressable.total += size
end
tick() click to toggle source
# File lib/pork/report/progressbar.rb, line 59
def tick
  progressable.increment
  thread.join if finished?
end