Sha256: 0f8a9cb0a99c4784768a0e3092b89e919a1466c38b8c481a6b42d395122e762d

Contents?: true

Size: 429 Bytes

Versions: 2

Compression:

Stored size: 429 Bytes

Contents

# frozen_string_literal: true

module Kingsman
  # Checks the scope in the given environment and returns the associated failure app.
  class Delegator
    def call(env)
      failure_app(env).call(env)
    end

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

      app || Kingsman::FailureApp
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kingsman-0.1.1 lib/kingsman/delegator.rb
kingsman-0.1.0 lib/kingsman/delegator.rb