Reputation: 2113
I'm writing a Ruby script and want behaviour like this:
every 15 seconds do
callback
end
How would I do this?
A quick search didn't show many libraries; Should I be using threads? I want this pretty basic since my Ruby script is going to be basic.
Upvotes: 1
Views: 1292
Reputation: 4321
You can also checkout EventMachine's PeriodicTimer class. I've used this with success in the past: http://eventmachine.rubyforge.org/EventMachine/PeriodicTimer.html
EventMachine may be overkill for your needs, though.
Upvotes: 0