Project

cogsworth

0.0
No commit activity in last 3 years
No release in over 3 years
A simple natural language time parser for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 2.0.0
 Project Readme

Cogsworth: Natural Language Time Parser for Ruby

An attempt to make a natural language time parser for Ruby so you can convert from something like "1 hour 20 min" to value in seconds, and vice versa.

The name of this gem is derived from Cogsworth, the character from Beauty and the Beast, who is a clock. Get it?

Usage

Cogsworth.string_to_seconds('2 hours 30 minutes') => 9000

Cogsworth.seconds_to_string(142510) => '1d 15h 35m 10s'

Acceptable String Formats

'2 days 1 hour 35 minutes 25 seconds'
'2days 1hr 35min 25sec'
'2d1h35m25s'