Class: ActionController::Middleware

Inherits:
Metal show all
Defined in:
lib/action_controller/middleware.rb

Defined Under Namespace

Classes: ActionMiddleware

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Metal

action, call, #content_type, #content_type=, controller_name, #controller_name, #dispatch, #env, inherited, #location, #location=, middleware, #params, #params=, #performed?, #response_body=, #status, #status=, #to_a, #url_for, use

Methods inherited from AbstractController::Base

abstract!, action_methods, #action_methods, #available_action?, clear_action_methods!, #controller_path, controller_path, hidden_actions, inherited, internal_methods, method_added, supports_path?

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



30
31
32
33
# File 'lib/action_controller/middleware.rb', line 30

def initialize(app)
  super()
  @_app = app
end

Class Method Details

.buildObject



15
# File 'lib/action_controller/middleware.rb', line 15

alias build new

.new(app) ⇒ Object



17
18
19
# File 'lib/action_controller/middleware.rb', line 17

def new(app)
  ActionMiddleware.new(self, app)
end

Instance Method Details

#indexObject



35
36
37
# File 'lib/action_controller/middleware.rb', line 35

def index
  call(env)
end

#process(action) ⇒ Object



24
25
26
27
28
# File 'lib/action_controller/middleware.rb', line 24

def process(action)
  response = super
  self.status, self.headers, self.response_body = response if response.is_a?(Array)
  response
end