Runs a Background Loop Forever

DevOps By Rultor.com We recommend RubyMine

rake PDD status Gem Version Test Coverage Yard Docs Hits-of-Code License

This simple Ruby gem helps you run a loop forever, in a background thread.

require 'always'
# Prepare, with five threads and 30-seconds delay between loop cycles:
a = Always.new(5, 30)
# Start them all together spinning forever:
a.start do
  puts "I'm alive"
end
# Stop them all together:
a.stop

How to contribute

Read these guidelines. Make sure you build is green before you contribute your pull request. You will need to have Ruby 3.0+ and Bundler installed. Then:

bundle update
bundle exec rake

If it's clean and you don't see any error messages, submit your pull request.