# File lib/ruby-progressbar/progress.rb, line 83 def percentage_completed return 0 if total.nil? return 100 if total == 0 # progress / total * 100 # # Doing this way so we can avoid converting each # number to a float and then back to an integer. # (progress * 100 / total).to_i end