Skip to content

Instantly share code, notes, and snippets.

@pgdaniel
Created August 1, 2014 23:39
Show Gist options
  • Save pgdaniel/9f1987976931ddc20102 to your computer and use it in GitHub Desktop.
Save pgdaniel/9f1987976931ddc20102 to your computer and use it in GitHub Desktop.
my fun spinner
module SimpleUtil
# Simple class to show status via stdout on really long rake tasks
class Spinner
attr_accessor :position
def initialize
@position = 0
@status_marker = ['|', '/', '-', '\\']
$stdout.sync = true
end
def rotate
print "#{@status_marker[@position]}\r"
if @position < @status_marker.length - 1
@position += 1
else
@position = 0
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment