Wobbly is a Ruby library that parses a given time-based token string to calculate a date in the future. It's lightweight and intuitive, perfect for adding flexible time calculations to your Ruby projects.
Ruby 2.0.0 or higher is recommended.
Install the gem with:
gem install wobblyrequire 'wobbly'
Wobbly.in('1h2m') # => 2017-11-27 19:58:44 +0200Wobbly supports the following tokens, which can be combined in any order:
s- secondsm- minutesh- hoursD- daysW- weeksM- months (approximated as 30 days)Y- years (approximated as 365 days)
Here are some usage examples demonstrating how Wobbly interprets different token strings:
Wobbly.in('1h2m8s') # Adds 1 hour, 2 minutes, and 8 seconds to the current time
Wobbly.in('5Y') # Adds 5 years to the current time
Wobbly.in('3Y8m') # Adds 3 years and 8 minutes to the current time
Wobbly.in('3Y8M2W1D') # Adds 3 years, 8 months, 2 weeks, and 1 day to the current timeTo test Wobbly, run the following command:
rake testPlease see LICENSE for licensing details.

