Natural language time span parsing & formatting
Switch branches/tags
Clone or download
Pull request Compare This branch is 8 commits ahead of joshbuddy:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Gemfile.lock
README.rdoc
Rakefile
VERSION
spanner-lfittl.gemspec

README.rdoc

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>