Class: CubaApi::Rack::AllowSessionRack

Inherits:
Object
  • Object
show all
Defined in:
lib/cuba_api/rack/allow_session_rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, *not_pattern) ⇒ AllowSessionRack

Returns a new instance of AllowSessionRack.



4
5
6
7
# File 'lib/cuba_api/rack/allow_session_rack.rb', line 4

def initialize( app, *not_pattern )
  @app = app
  @regexp = /^\/#{not_pattern.join( '|^\/' )}/
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/cuba_api/rack/allow_session_rack.rb', line 9

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