mojombo/chronic — pull request #231 by TalkativeTree (2013-12-05 10:13:46+00:00)
Title: Minutizer

Add Chronic.minutize(text) to extract the duration from text.

I use this personally to extract the duration of events from updates or events to set the duration, start and end times, etc. I chose minutes, because most information displayed to users is in minutes or hours, but not seconds.

Some examples of use:
```ruby
Chronic.minutize("The experiment lasted for 321 seconds")
=> 5.35
Chronic.minutize("I took one sleeping pill and slept for half a day")
=> 720
Chronic.minutize("I was traveling for a week and a half")
=> 15120.0
Chronic.minutize("I traveled for 2 days, three hrs, and forty mintes")
=> 3100
Chronic.minutize("The conference lasted 2 weeks")
=> 20160.0
```
Another cool thing you can do with this new feature is utilize Chronic's Span to return a span based on the text's create_at (or another anchoring time).