I used this:
def show
every_n_seconds (120) do
#code to do
end
end
And all the way at the top, (so that ruby sees that method before anything else), I have:
def every_n_seconds(n)
loop do
before = Time.now
yield
interval = n-(Time.now-before)
sleep(interval) if interval > 0
end
end
It is working quite nice. Thanks everyone anyway. I hope this can help someone in the future.