From: Claire Hill Date: 2009-04-09T16:09:59+09:00 Subject: Re: Exit loop after checking for some time Bosko Ivanisevic wrote: > Easiest way is to add one more argument to the repeat_every function: > > def repeat_every(seconds, checks_count) > check_no = 0 > begin > time_spent = time_block { yield } > check_no += 1 > break if check_no >= checks_count > sleep(seconds - time_spent) > end while time_spent < seconds > end > > And call it with: > > repeat_every(300, 4) {....} hey there, thank you so much..you save me!!! my heartfelt thanks :) -- Posted via http://www.ruby-forum.com/.