Parent

Methods

Class/Module Index [+]

Quicksearch

PhusionPassenger::ProgressBar

Constants

THROBBLER

Public Class Methods

new(output = STDOUT) click to toggle source
# File lib/phusion_passenger/utils/progress_bar.rb, line 29
def initialize(output = STDOUT)
  @output = output
  @tty = output.tty?
  @throbbler_index = 0
end

Public Instance Methods

finish() click to toggle source
# File lib/phusion_passenger/utils/progress_bar.rb, line 50
def finish
  @output.write("\n")
  @output.flush
end
set(percentage) click to toggle source
# File lib/phusion_passenger/utils/progress_bar.rb, line 35
def set(percentage)
  if @tty
    width = (percentage * 50).to_i
    bar   = "*" * width
    space = " " * (50 - width)
    text = sprintf("[%s%s] %s", bar, space, THROBBLER[@throbbler_index])
    @throbbler_index = (@throbbler_index + 1) % THROBBLER.size
    @output.write("#{text}\r")
    @output.flush
  else
    @output.write(".")
    @output.flush
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.