Skip to content

Instantly share code, notes, and snippets.

@lexer
Created November 1, 2010 07:58
Show Gist options
  • Save lexer/657798 to your computer and use it in GitHub Desktop.
Save lexer/657798 to your computer and use it in GitHub Desktop.
STDOUT.sync = true
def loadify(message = "", &block)
characters = %w[| / - \\ | / - \\]
thread = Thread.new do
block.call
end
while thread.alive?
next_character = characters.shift
output = "#{next_character} #{message}"
print output
characters << next_character
sleep 0.1
print "\b" * (output.length)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment