mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ActionPack Proc.new without a block
This commit fixes cases that use pre Ruby [r66772](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/trunk/revisions/66772) syntax that are not tickled by the test suite.
This commit is contained in:
parent
87a5379b42
commit
c99e673902
2 changed files with 4 additions and 4 deletions
|
@ -26,10 +26,10 @@ module ActionController
|
|||
end
|
||||
end
|
||||
|
||||
def build(action, app = Proc.new)
|
||||
def build(action, app = nil, &block)
|
||||
action = action.to_s
|
||||
|
||||
middlewares.reverse.inject(app) do |a, middleware|
|
||||
middlewares.reverse.inject(app || block) do |a, middleware|
|
||||
middleware.valid?(action) ? middleware.build(a) : a
|
||||
end
|
||||
end
|
||||
|
|
|
@ -97,8 +97,8 @@ module ActionDispatch
|
|||
middlewares.push(build_middleware(klass, args, block))
|
||||
end
|
||||
|
||||
def build(app = Proc.new)
|
||||
middlewares.freeze.reverse.inject(app) { |a, e| e.build(a) }
|
||||
def build(app = nil, &block)
|
||||
middlewares.freeze.reverse.inject(app || block) { |a, e| e.build(a) }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue