From: lasitha Date: 2009-04-09T22:37:44+09:00 Subject: Re: Exit loop after checking for some time On Thu, Apr 9, 2009 at 8:29 AM, Claire Hill wrote: > [...] > > def repeat_every(seconds) >  begin >    time_spent = time_block { yield } >    sleep(seconds - time_spent) >  end while time_spent < seconds > end FYI, if time_spent > seconds in the above method, the call to sleep will raise 'ArgumentError: time interval must be positive'. cheers, lasitha