No commit activity in last 3 years
No release in over 3 years
Conditional wrapper for Rack middleware. This is a port of Plack::Middleware::Conditional.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.12
~> 5.9
>= 0
>= 12.3.3
~> 1.4

Runtime

>= 1.6.12
 Project Readme

Rack::Conditional

Conditional wrapper for Rack middleware. This is a port of Plack::Middleware::Conditional.

Installation

Add this line to your application's Gemfile:

gem 'rack-conditional'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-conditional

Usage

# config.ru
require 'rack_conditional'
use_if proc { |env| env['REMOTE_ADDR'] == '127.0.0.1' }, ShowExceptions

Or

# config.ru
require 'rack_conditional'
use Rack::Conditional, proc { |env| env['REMOTE_ADDR'] == '127.0.0.1' }, ShowExceptions

Or

# Sinatra
require 'rack_conditional'
class YourApp < Sinatra::Base
  use_if proc { |env| env['REMOTE_ADDR'] == '127.0.0.1' }, ShowExceptions
end

Or

# Rails
# config/application.rb
require 'rack_conditional'
module YourApp
  class Application < Rails::Application
    config.middleware.use_if proc { |env| env['REMOTE_ADDR'] == '127.0.0.1' }, ShowExceptions
  end
end

License

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/masiuchi/rack-conditional.