Object
A progress reporter that prints out messages about the current progress.
# File lib/rubygems/user_interaction.rb, line 506 506: def done 507: @progress = 100 if @units == '%' 508: update_display(true, true) 509: end
# File lib/rubygems/user_interaction.rb, line 485 485: def fetch(file_name, total_bytes) 486: @file_name = file_name 487: @total_bytes = total_bytes.to_i 488: @units = @total_bytes.zero? ? 'B' : '%' 489: 490: update_display(false) 491: end
# File lib/rubygems/user_interaction.rb, line 493 493: def update(bytes) 494: new_progress = if @units == 'B' then 495: bytes 496: else 497: ((bytes.to_f * 100) / total_bytes.to_f).ceil 498: end 499: 500: return if new_progress == @progress 501: 502: @progress = new_progress 503: update_display 504: end
# File lib/rubygems/user_interaction.rb, line 513 513: def update_display(show_progress = true, new_line = false) 514: return unless @out.tty? 515: 516: if show_progress then 517: @out.print "\rFetching: %s (%3d%s)" % [@file_name, @progress, @units] 518: else 519: @out.print "Fetching: %s" % @file_name 520: end 521: @out.puts if new_line 522: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.