Object
Ruby/ProgressBar - a text progress bar library
Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org>
All rights reserved. This is free software with ABSOLUTELY NO WARRANTY.
You can redistribute it and/or modify it under the terms of Ruby’s license.
# File lib/taps/progress_bar.rb, line 15 def initialize (title, total, out = STDERR) @title = title @total = total @out = out @terminal_width = 80 @bar_mark = "=" @current = 0 @previous = 0 @finished_p = false @start_time = Time.now @previous_time = @start_time @title_width = 14 @format = "%-#{@title_width}s %3d%% %s %s" @format_arguments = [:title, :percentage, :bar, :stat] clear show end
# File lib/taps/progress_bar.rb, line 177 def clear @out.print "\r" @out.print(" " * (get_width - 1)) @out.print "\r" end
# File lib/taps/progress_bar.rb, line 193 def file_transfer_mode @format_arguments = [:title, :percentage, :bar, :stat_for_file_transfer] end
# File lib/taps/progress_bar.rb, line 183 def finish @current = @total @finished_p = true show end
# File lib/taps/progress_bar.rb, line 189 def finished? @finished_p end
# File lib/taps/progress_bar.rb, line 197 def format= (format) @format = format end
# File lib/taps/progress_bar.rb, line 201 def format_arguments= (arguments) @format_arguments = arguments end
# File lib/taps/progress_bar.rb, line 205 def halt @finished_p = true show end
# File lib/taps/progress_bar.rb, line 210 def inc (step = 1) @current += step @current = @total if @current > @total show_if_needed @previous = @current end
Generated with the Darkfish Rdoc Generator 2.