Skip to content

Instantly share code, notes, and snippets.

@prydonius
Created July 3, 2012 19:55
Show Gist options
  • Save prydonius/3042533 to your computer and use it in GitHub Desktop.
Save prydonius/3042533 to your computer and use it in GitHub Desktop.
Overriding cursor to set speed
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