Skip to content

Instantly share code, notes, and snippets.

@carpeliam
Created July 14, 2015 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carpeliam/69ce1ba26aee416cf87a to your computer and use it in GitHub Desktop.
Save carpeliam/69ce1ba26aee416cf87a to your computer and use it in GitHub Desktop.
Ruby console progress bar
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