Project

time_sugar

0.0
No commit activity in last 3 years
No release in over 3 years
Syntactic sugar for handling time.
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
>= 0
 Project Readme

TimeSugar Build Status Code Climate Code Climate Coverage Dependency Status Gem Version

Syntactic sugar for handling time. If you are familiar with Active Support, but you don't want to add the whole library for just handling time, time_sugar may be helpful.

Installation

Add this line to your application's Gemfile:

gem 'time_sugar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install time_sugar

Usage

Time sugar add some utility methods to Fixnum, which are useful for doing stuff like this:

1.second #=> 1
1.minute #=> 60
1.hour #=> 3600
1.day #=> 86400
1.week #=> 604800

Time.now #=> 2014-02-11 23:55:47 -0300
1.minute.ago #=> 2014-02-11 23:55:46 -0300

Time.now #=> 2014-02-11 23:55:47 -0300
1.minute.ago #=> 2014-02-11 23:54:47 -0300

Time.now #=> 2014-02-11 23:55:47 -0300
1.hour.ago #=> 2014-02-11 22:55:47 -0300

Time.now #=> 2014-02-11 23:55:47 -0300
1.day.ago #=> 2014-02-10 23:55:47 -0300

Time.now #=> 2014-02-11 23:55:47 -0300
1.week.ago #=> 2014-02-04 23:55:47 -0300

Is it any good?

I don't know!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

See the LICENSE.