hi all, i'm really new to ruby and i need to do a script that will check
my email every 5minutes and after 20minutes of no new mail it will
produce "test fail" (im a tester by the way). i have found a cool code
for checking email every 5min but i could not find a way to stop it
after 20minutes? any help is greatly appreciated :)

here's the code: (i took credit to the originator of the code here and
my sincere thanks..:))

def time_block
  start_time = Time.now
  Thread.new { yield }
  Time.now - start_time
end

def repeat_every(seconds)
 begin
    time_spent = time_block { yield }
    sleep(seconds - time_spent)
 end while time_spent < seconds
end


repeat_every(300) { # checking of email ever 5 minutes
  puts "Start checking: #{Time.now}"
  # email checking here
  puts "End checking: #{Time.now}"
}
-- 
Posted via http://www.ruby-forum.com/.