lasitha
4/9/2009 1:38:00 PM
On Thu, Apr 9, 2009 at 8:29 AM, Claire Hill <cartajo@gmail.com> wrote:
> [...]
>
> def repeat_every(seconds)
> =A0begin
> =A0 =A0time_spent =3D time_block { yield }
> =A0 =A0sleep(seconds - time_spent)
> =A0end 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