Timer class-newbie

I know nothing of the timer class and I want to have my ruby app wake up
in 30 minutes (or more) and have a handler for it…I don’t want to spin
in a sleep loop waiting 30 minutes - can timer class handle this?

Examples welcome or point me to a web page that has examples

Thanks in advance

Joe

On Sep 25, 2011, at 10:28 AM, Joe C. wrote:

I know nothing of the timer class and I want to have my ruby app wake up
in 30 minutes (or more) and have a handler for it…I don’t want to spin
in a sleep loop waiting 30 minutes - can timer class handle this?

Examples welcome or point me to a web page that has examples

Thanks in advance

Joe

I don’t believe there is a built-in ruby timer class per se.

What you might try is a combination of Thread and Kernel.sleep()
such as

t = Thread.new {

bulk of your app goes here

}

sleep(1800) # take a half hour snooze

time to take action such as

t.kill

Dan N.

http://systemtimer.rubyforge.org/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs