Repository is archived
No commit activity in last 3 years
No release in over 3 years
A simple way to do real after filtering with Sinatra.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

~> 1.4.0
 Project Readme

Sinatra::RunLater

A simple way to do real after filtering with Sinatra.

A gem-ed up version of a slight modification of this version that cleans up nicely when used through rackup and ctrl-c is sent.

Installation

Add this line to your application's Gemfile:

gem 'sinatra-run-later', :require => 'sinatra/run-later'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sinatra-run-later

Usage

Anywhere in your Sinatra app, just drop in something like this:

get '/' do
  run_later do
    # some task that you don't want to block.
  end

  "Hello World"
end

If you're running a modular style app, just add the helpers like so:

class YourApp
  configure do
    helpers Sinatra::RunLater::InstanceMethods
  end
end

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