Class: ActionController::MiddlewareStack

Inherits:
ActionDispatch::MiddlewareStack show all
Defined in:
actionpack/lib/action_controller/metal.rb

Overview

Extend ActionDispatch middleware stack to make it aware of options allowing the following syntax in controllers:

class PostsController < ApplicationController
  use AuthenticationMiddleware, :except => [:index, :show]
end

Defined Under Namespace

Classes: Middleware

Instance Method Summary (collapse)

Methods inherited from ActionDispatch::MiddlewareStack

#initialize, #insert, #insert_after, #swap, #use

Methods inherited from Array

#as_json, #encode_json, #extract_options!, #fifth, #forty_two, #fourth, #from, #in_groups, #in_groups_of, #sample, #second, #split, #third, #to, #to_formatted_s, #to_param, #to_query, #to_sentence, #to_xml, #uniq_by, #uniq_by!, wrap

Constructor Details

This class inherits a constructor from ActionDispatch::MiddlewareStack

Instance Method Details

- (Object) build(action, app = nil, &block)



34
35
36
37
38
39
40
41
42
43
# File 'actionpack/lib/action_controller/metal.rb', line 34

def build(action, app=nil, &block)
  app  ||= block
  action = action.to_s
  raise "MiddlewareStack#build requires an app" unless app

  reverse.inject(app) do |a, middleware|
    middleware.valid?(action) ?
      middleware.build(a) : a
  end
end