0.01
No commit activity in last 3 years
No release in over 3 years
Converts seconds like 7261 into a human readable string '2h1m1s'
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.5
~> 5.4.0
>= 0
 Project Readme

HumanSeconds

Converts seconds like 7261 into a human readable string '2h1m1s'.

Also can parse that format back to integer seconds.

Installation

Add this line to your application's Gemfile:

gem 'human_seconds'

And then execute:

$ bundle

Or install it yourself as:

$ gem install human_seconds

Usage

hs = HumanSeconds.new(61)
hs.to_i #=> 61
hs.to_s #=> 1m1s

HumanSeconds.parse('1m1s').to_i # => 61

Contributing

  1. Fork it ( http://github.com//human_seconds/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Make sure specs pass (bundle exec rake spec)
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request