From: Yaser Sulaiman Date: 2008-11-05T03:34:27+09:00 Subject: Re: Showing a spinner ? ------=_Part_85867_20998637.1225823746235 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I think a STDOUT.flush is needed after the second print "\b" to make it work properly. On Tue, Nov 4, 2008 at 7:22 PM, Rodrigo Bermejo wrote: > Aldric Giacomoni wrote: > > How do I show a spinner on the command line interface when a ruby script > > is working? I sometimes write things that take a while, and I know I get > > impatient when all I see a blinking cursor :) > > A spinner has \ | / - all in one spot so it looks like a spinning wheel. > > > > Thanks! > > > > --Aldric > > Here is the idea ..you can make it better.. > > a=["-","\\","|","/"] > n=0 > while 1 do > print a[n % 4] > print "\b" > n+=1 > sleep 0.1 > puts "..#{n}." if (n % 50==0) > end > > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_85867_20998637.1225823746235--