Skip to content

Instantly share code, notes, and snippets.

@christian-marie
Last active December 19, 2015 09:09
Show Gist options
  • Save christian-marie/5931153 to your computer and use it in GitHub Desktop.
Save christian-marie/5931153 to your computer and use it in GitHub Desktop.
Very simple progress bar for ruby.
def progress p
t=p;p=[p.to_i,100].min;p>>=1
print("[#{'*'*p}#{' '*(50-p)}] #{t.round}%\r")
STDOUT.flush
end
1.upto(100){|i| progress(i); sleep 0.1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment