Skip to content

Instantly share code, notes, and snippets.

@adamgamble
Created May 26, 2010 21:30
Show Gist options
  • Save adamgamble/415099 to your computer and use it in GitHub Desktop.
Save adamgamble/415099 to your computer and use it in GitHub Desktop.
def makeProgress(i, t)
percent = (Float(i) / Float(t)) * 100
percent = (( percent / 5).round * 5).to_i
number_of_bars = percent / 5
progress = ""
for g in 0..number_of_bars do
progress = progress + "="
end
progress = progress + percent.to_s + "%"
for s in 0..(20 - number_of_bars) do
progress = progress + " "
end
return "[0%]" + progress + "[100%]"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment