Created
July 14, 2015 15:56
-
-
Save carpeliam/69ce1ba26aee416cf87a to your computer and use it in GitHub Desktop.
Ruby console progress bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def progress_bar(current, total, width=80) | |
pos = (current.to_f / total * width).round | |
print "\r|#{'=' * pos}#{'-' * (width - pos)}|" | |
puts if current == total | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment