Class: SimpleCaptcha::Middleware
- Inherits:
-
Object
- Object
- SimpleCaptcha::Middleware
- Includes:
- ImageHelpers
- Defined in:
- lib/simple_captcha/middleware.rb
Constant Summary collapse
- DEFAULT_SEND_FILE_OPTIONS =
{ :type => 'application/octet-stream'.freeze, :disposition => 'attachment'.freeze, }.freeze
Constants included from ImageHelpers
Instance Method Summary collapse
-
#call(env) ⇒ Object
:nodoc:.
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from ImageHelpers
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
11 12 13 14 |
# File 'lib/simple_captcha/middleware.rb', line 11 def initialize(app, ={}) @app = app self end |
Instance Method Details
#call(env) ⇒ Object
:nodoc:
16 17 18 19 20 21 22 |
# File 'lib/simple_captcha/middleware.rb', line 16 def call(env) # :nodoc: if env["REQUEST_METHOD"] == "GET" && captcha_path?(env['PATH_INFO']) make_image(env) else @app.call(env) end end |