Class: CubaApi::NoSessionRack

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

Instance Method Summary collapse

Constructor Details

#initialize(app, *not_pattern) ⇒ NoSessionRack

Returns a new instance of NoSessionRack.



3
4
5
6
# File 'lib/cuba_api/no_session_rack.rb', line 3

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

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/cuba_api/no_session_rack.rb', line 8

def call( env )
  status, headers, resp = @app.call( env )
  if not( env[ 'PATH_INFO' ] =~ @regexp )
    headers.delete( 'Set-Cookie' )
  end
  [ status, headers, resp ]
end