
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 RubyGem that reports how long a specific Ruby command or block of code takes to run.
Simply run clocker
followed by a command or block of code. Add an -m
before the command or block to print out start and end times.
Ex. 1
$ clocker "puts 'hi'"
hi
Clocked at 0 mins, 0 secs, 0 ms
Ex. 2
$ clocker "2.times { puts 'hello world'; sleep(0.6) }"
hello world
hello world
Clocked at 0 mins, 1 secs, and 210 ms
Ex. 3
$ clocker -m "1.upto(5) { |i| print i+1; sleep(0.4) }"
start: 2015-08-18 16:16:47 -0700
23456
ended: 2015-08-18 16:16:49 -0700
Clocked at 0 mins, 2 secs, and 12 ms
Add this line to your application's Gemfile:
gem 'clocker'
And then execute:
$ bundle
Or install it yourself as:
$ gem install clocker
Sample code block:
>> clocker = Clocker.new
>> clocker.clock do
>> # code here
>> end
By default, clocker will not print out the start time before the command|block, or the end time after the command|block, unless you pass the instance show_messages: true
.
>> c1 = Clocker.new
>> duration = c1.clock do
>> 3.times { print 'c1'; sleep(1) }
>> end
>> puts
>> puts duration
c1c1c1
{:mins=>0, :secs=>3, :ms=>13}
>> c2 = Clocker.new(show_messages: true)
>> duration = c2.clock do
>> 3.times { print 'c2'; sleep(1) }
>> end
>> puts duration
start: 2015-08-18 16:07:17 -0700
c2c2c2
ended: 2015-08-18 16:07:20 -0700
{:mins=>0, :secs=>3, :ms=>14}
Bug reports and pull requests are welcome on GitHub at https://github.com/michaelchadwick/clocker.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that clocker 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.