No commit activity in last 3 years
No release in over 3 years
You can be a Time Traveler.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
~> 0.8.0
 Project Readme

Rack::TimeTraveler

Build Status Coverage Status Dependency Status Gem Version

Rack::TimeTraveler is a Rack::Middleware, and provides "time travel" capabilities.

Installation

Add this line to your application's Gemfile:

gem 'rack-timetraveler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-timetraveler

Usage

Simple usage

use Rack::TimeTraveler

If you needs customized usage

@fetcher = lambda do |env|
  # You can fetch customized timestamp.
  # Default is fetch from ENV['RACK_TIME_TRAVELER_TIMESTAMP']
  0
end

use Rack::TimeTraveler,
  timestamp_fetcher: @fetcher,          # You can also fetch from cache/DB
  enabled_environments: [:development]  # enabled only development

Examples

See examples/app_1.ru

$ bundle exec rackup examples/app_1.ru
$ curl localhost:9292
$ curl localhost:9292 -H 'RACK_TIME_TRAVELER_TIMESTAMP:0'
Time is 1970-01-01 09:00:00 +0900

Contributing

  1. Fork it ( https://github.com/luckypool/rack-timetraveler/fork )
  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 a new Pull Request