Skip to content

Instantly share code, notes, and snippets.

@jamescook
Forked from adamgamble/gist:415099
Created May 26, 2010 21:37
Show Gist options
  • Select an option

  • Save jamescook/415104 to your computer and use it in GitHub Desktop.

Select an option

Save jamescook/415104 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 = "B"
for g in 0..number_of_bars do
progress = progress + "="
end
if number_of_bars > 0
progress = progress + "D"
end
progress = progress + " " + percent.to_s + "%"
for s in 0..(20 - number_of_bars) do
progress = progress + " "
end
if percent == 100
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