make Ruby script run once a second

Posted by Matt Hintzke on Stack Overflow See other posts from Stack Overflow or by Matt Hintzke
Published on 2012-12-09T21:21:41Z Indexed on 2012/12/09 23:04 UTC
Read the original article Hit count: 200

Filed under:

I have a ruby script that needs to run about 1 time a second. What I am doing is using a ruby script to keep track of modifications of files in a directory. I want the script to run once a second so that the modifications are updated in "live" time.

Basically, I want my script to do the same kind of thing as running "top" on a unix shell. Where the screen is updated every second or so. Is there an equivalent to setInterval in ruby like there is in javascript?

Thanks

© Stack Overflow or respective owner

Related posts about ruby