Class: CubaApi::AllowSessionRack
- Inherits:
-
Object
- Object
- CubaApi::AllowSessionRack
- Defined in:
- lib/cuba_api/allow_session_rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, *not_pattern) ⇒ AllowSessionRack
constructor
A new instance of AllowSessionRack.
Constructor Details
#initialize(app, *not_pattern) ⇒ AllowSessionRack
3 4 5 6 |
# File 'lib/cuba_api/allow_session_rack.rb', line 3 def initialize( app, *not_pattern ) @app = app @regexp = /^\/#{not_pattern.join( '|^\/' )}/ end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/cuba_api/allow_session_rack.rb', line 8 def call( env ) status, headers, resp = @app.call( env ) if not( env[ 'PATH_INFO' ].match @regexp ) headers.delete( 'Set-Cookie' ) end [ status, headers, resp ] end |