Class: Balrog::Middleware

Inherits:
Object
  • Object
show all
Includes:
Controller
Defined in:
lib/balrog/middleware.rb,
lib/balrog/middleware/controller.rb

Overview

Methods that are called in response to specific application requests.

Defined Under Namespace

Modules: Controller

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Controller

#logout, #omniauthentication, #password_login

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



23
24
25
# File 'lib/balrog/middleware.rb', line 23

def initialize(app)
  @app = app
end

Class Method Details

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



41
42
43
# File 'lib/balrog/middleware.rb', line 41

def self.setup
  yield self
end

Instance Method Details

#call(env) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/balrog/middleware.rb', line 27

def call(env)
  path = env["PATH_INFO"]
  method = env["REQUEST_METHOD"]
  if (path, method)
    (env)
  elsif omniauth_request?(path, method)
    omniauthentication(env)
  elsif logout_request?(path, method)
    logout(env)
  else
    @app.call(env)
  end
end