提交 18dbad80 编写于 作者: X Xavier Noria

revises RDoc in AC::Metal [ci skip]

上级 4363368e
...@@ -203,36 +203,29 @@ def to_a #:nodoc: ...@@ -203,36 +203,29 @@ def to_a #:nodoc:
class_attribute :middleware_stack class_attribute :middleware_stack
self.middleware_stack = ActionController::MiddlewareStack.new self.middleware_stack = ActionController::MiddlewareStack.new
def self.inherited(base) #nodoc: def self.inherited(base) # :nodoc:
base.middleware_stack = self.middleware_stack.dup base.middleware_stack = self.middleware_stack.dup
super super
end end
# Adds given middleware class and its args to bottom of middleware_stack # Pushes the given Rack middleware and its arguments to the bottom of the
# middleware stack.
def self.use(*args, &block) def self.use(*args, &block)
middleware_stack.use(*args, &block) middleware_stack.use(*args, &block)
end end
# Alias for middleware_stack # Alias for +middleware_stack+.
def self.middleware def self.middleware
middleware_stack middleware_stack
end end
# Makes the controller a rack endpoint that points to the action in # Makes the controller a Rack endpoint that runs the action in the given
# the given env's action_dispatch.request.path_parameters key. # +env+'s +action_dispatch.request.path_parameters+ key.
def self.call(env) def self.call(env)
action(env['action_dispatch.request.path_parameters'][:action]).call(env) action(env['action_dispatch.request.path_parameters'][:action]).call(env)
end end
# Return a rack endpoint for the given action. Memoize the endpoint, so # Returns a Rack endpoint for the given action name.
# multiple calls into MyController.action will return the same object
# for the same action.
#
# ==== Parameters
# * <tt>action</tt> - An action name
#
# ==== Returns
# * <tt>proc</tt> - A rack application
def self.action(name, klass = ActionDispatch::Request) def self.action(name, klass = ActionDispatch::Request)
middleware_stack.build(name.to_s) do |env| middleware_stack.build(name.to_s) do |env|
new.dispatch(name, klass.new(env)) new.dispatch(name, klass.new(env))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册