The ‘timers’ gem provides easy-to-use timer collections that can be
used independently or inside of event loops:
The timers gem is an extraction of Celluloid’s timers, as they can be
generally used inside of any event loop that supports a timeout and
wants
to provide scheduled events. The timers gem can be used alongside
Kernel.select or the nio4r gem which provides a scalable IO selector
API:
The actual implementation is small (~110 loc) but should be useful to
anyone needing efficient timer functionality in pure Ruby: