Created
July 3, 2012 19:55
-
-
Save prydonius/3042533 to your computer and use it in GitHub Desktop.
Overriding cursor to set speed
This file contains 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
require "spinning_cursor" | |
module SpinningCursor | |
class Cursor | |
def spinner | |
delay = 0.1 # change the delay here | |
spinners = ['|', '/', '-', '\\'] | |
i = 0 | |
loop do | |
print " " unless @banner.empty? | |
print spinners[i % 4] | |
sleep delay | |
SpinningCursor.reset_line @banner | |
i += 1 | |
end | |
end | |
end | |
end | |
SpinningCursor.start do | |
banner "An amazing task is happening" | |
type :spinner | |
action do | |
# Zzz | |
sleep 10 | |
end | |
message "Huh?! I'm awake!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment