Skip to content

Instantly share code, notes, and snippets.

@stepahn
Created June 22, 2009 14:03
Show Gist options
  • Save stepahn/133979 to your computer and use it in GitHub Desktop.
Save stepahn/133979 to your computer and use it in GitHub Desktop.
class Spinner
CHARS = %w{- \\ | / }
def initialize
@step=-1
end
def to_s
"\r#{char}"
end
def method_name
end
def char
CHARS[@step%CHARS.length]
end
def next
@step+= 1
self
end
end
s=Spinner.new
10.times do
sleep 0.3
print s.next
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment