Class: BetterAuth::Sinatra::MountedApp

Inherits:
Object
  • Object
show all
Defined in:
lib/better_auth/sinatra/mounted_app.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, auth, mount_path:) ⇒ MountedApp

Returns a new instance of MountedApp.



6
7
8
9
10
# File 'lib/better_auth/sinatra/mounted_app.rb', line 6

def initialize(app, auth, mount_path:)
  @app = app
  @auth = auth
  @mount_path = normalize_path(mount_path)
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
# File 'lib/better_auth/sinatra/mounted_app.rb', line 12

def call(env)
  return auth.call(env) if mounted_path?(env["PATH_INFO"])

  @app.call(env)
end