
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
A simple interface for creating timers with callbacks that handles all the threading for you.
Add this line to your application's Gemfile:
gem 'easy_timers'
Or install it yourself as:
$ gem install easy_timers
Create a new group of timers with EasyTimers::Timers.new
:
require 'easy_timers'
timers = EasyTimers::Timers.new
Schedule a timer to execute 10 seconds from now with EasyTimers::Timers#after
:
timers.after(10) { puts "Hello world" }
Now timers
has a single timer that will call its block in ten seconds.
You can also supply a ruby Time object instead of an interval.
the_future = Time.now + 10
timers.after(the_future) { put "Ten seconds have passed." }
If you want to be able to cancel a specific timer, you should give it a name:
timers.after(60, :one_minute) { puts "It's been 60 seconds." }
# do some work and decide to change our mind
timers.cancel(:one_minute)
If you'd rather not mint your own names, one will be generated for you:
timer_name = timers.after(10) { puts "hai" }
timers.cancel(timer_name)
You can also create periodic timers with EasyTimers::Timers#every
:
timer_name = timers.every(1) { puts "One second has passed." }
Periodic timers will be scheduled repeatedly until cancelled.
Need a combination of the above? You can schedule a period timer to start at a certain time, then scheduled repeatedly using a different interval:
timer_name = timers.after_then_every(0.5, 0.1, :my_timer) { puts "tic toc" }
The above timer will first fire after half a second, then fire every 0.1 seconds thereafter.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that easy_timers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.