Spanner¶ ↑
Easy way to parse natural language time spans as periods expressed in seconds. Supports float point notions of spans as well.
Installation¶ ↑
gem install spanner-lfittl
or add this to your Gemfile:
gem 'spanner-lfittl', :require => 'spanner'
Usage¶ ↑
require 'spanner' Spanner.parse('1s') => 1 Spanner.parse('23 hours 12 minutes') => 83520 Spanner.format(83520) => '23 hours 12 minutes' Spanner.format(83520, :biggest_unit => :minutes) => '1392 minutes'
Authors¶ ↑
Original author: Joshua Hull <joshbuddy@gmail.com>
Newer contributions: Lukas Fittl <lukas@fittl.com>