lib/phusion_passenger/utils/progress_bar.rb in passenger-5.0.0.beta3 vs lib/phusion_passenger/utils/progress_bar.rb in passenger-5.0.0.rc1

- old
+ new

@@ -21,36 +21,36 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. module PhusionPassenger -class ProgressBar - THROBBLER = ["-", "\\", "|", "/", "-"] + class ProgressBar + THROBBLER = ["-", "\\", "|", "/", "-"] - def initialize(output = STDOUT) - @output = output - @tty = output.tty? - @throbbler_index = 0 - end + def initialize(output = STDOUT) + @output = output + @tty = output.tty? + @throbbler_index = 0 + end - 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 + 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 - def finish - @output.write("\n") - @output.flush - end -end + def finish + @output.write("\n") + @output.flush + end + end end # module PhusionPassenger