Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
hpoydar-chronic_duration
Advanced tools
= Chronic Duration
A simple Ruby natural language parser for elapsed time. (For example, 4 hours and 30 minutes, 6 minutes 4 seconds, 3 days, etc.) Returns all results in seconds. Will return an integer unless you get tricky and need a float. (4 minutes and 13.47 seconds, for example.)
The reverse can also be accomplished with the output method. So pass in seconds and you can get strings like 4 mins 31.51 secs (default format), 4h 3m 30s, or 4:01:29.
== Installation
$ sudo gem sources -a http://gems.github.com
$ sudo gem install hpoydar-chronic_duration
== Usage
>> require 'chronic_duration'
=> true
>> ChronicDuration.parse('4 minutes and 30 seconds')
=> 270
>> ChronicDuration.output(270)
=> 4 mins 30 secs
>> ChronicDuration.output(270, :format => :short)
=> 4m 30s
>> ChronicDuration.output(270, :format => :long)
=> 4 minutes 30 seconds
>> ChronicDuration.output(270, :format => :chrono)
=> 4:30
Nil is returned if the string can't be parsed
Examples of parse-able strings:
== Contributors
jduff, olauzon
== TODO
FAQs
Unknown package
We found that hpoydar-chronic_duration 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.