Class: TinyCaptcha::Middleware
- Inherits:
-
Object
- Object
- TinyCaptcha::Middleware
- Includes:
- ImageHelpers
- Defined in:
- lib/tiny_captcha/middleware.rb
Constant Summary collapse
- DEFAULT_SEND_FILE_OPTIONS =
{ :type => 'application/octet-stream'.freeze, :disposition => 'attachment'.freeze, }.freeze
- CODE_KEY =
'code'
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.
13 14 15 16 |
# File 'lib/tiny_captcha/middleware.rb', line 13 def initialize(app, ={}) @app = app self end |
Instance Method Details
#call(env) ⇒ Object
:nodoc:
18 19 20 21 22 23 24 25 |
# File 'lib/tiny_captcha/middleware.rb', line 18 def call(env) # :nodoc: if env["REQUEST_METHOD"] == "GET" && env['PATH_INFO'].start_with?(::TinyCaptcha.image_show_path) # /tiny_captcha/images/show?code=abcdefg make_image(env) else @app.call(env) end end |