Class: Kingsman::Delegator

Inherits:
Object
  • Object
show all
Defined in:
lib/kingsman/delegator.rb

Overview

Checks the scope in the given environment and returns the associated failure app.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



6
7
8
# File 'lib/kingsman/delegator.rb', line 6

def call(env)
  failure_app(env).call(env)
end

#failure_app(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/kingsman/delegator.rb', line 10

def failure_app(env)
  app = env["warden.options"] &&
    (scope = env["warden.options"][:scope]) &&
    Kingsman.mappings[scope.to_sym].failure_app

  app || Kingsman::FailureApp
end