TimeBucket

For finding the time buckets.

Installation

Add this line to your application's Gemfile:

gem 'time_bucket'

And then execute:

$ bundle

Or install it yourself as:

$ gem install time_bucket

Usage

TimeBucket.bucket_from_seconds(Time.now - 2.days.ago)
# => "longer than 1 day"

TimeBucket.bucket_from_seconds(Time.now - 20.minutes.ago)
# => "30 minutes"

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