Skip to content

GoDuration Ruby Gem - Parses and generates Go's time.Duration format

Notifications You must be signed in to change notification settings

justincampbell/go_duration_ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDuration for Ruby

Gem Version Build Status

Installation

Add this line to your application's Gemfile:

gem 'go_duration'

And then execute:

$ bundle

Or install it yourself as:

$ gem install go_duration

Usage

Parsing

require 'go_duration'

GoDuration.parse("2m30s") # => 150

Generating

require 'go_duration'

GoDuration.generate(150) # => "2m30s"

require 'go_duration/core_ext'

150.to_go_duration # => "2m30"

require 'active_support/core_ext'

(2.hours + 45.minutes).to_go_duration # => "2h45m"

About

GoDuration Ruby Gem - Parses and generates Go's time.Duration format

Topics

Resources

Stars

Watchers

Forks

Packages