diff options
author | utilum <oz@utilum.com> | 2019-02-03 03:35:05 +0100 |
---|---|---|
committer | utilum <oz@utilum.com> | 2019-02-13 02:11:21 +0100 |
commit | c99e673902539a0bb1762a8786671f812076c2d9 (patch) | |
tree | 91515ca3d4e09094f8ff02cea5ca89b5ec4ad91d /actionpack/lib | |
parent | 87a5379b422d38ea8766af1537593af44b6dffc6 (diff) | |
download | rails-c99e673902539a0bb1762a8786671f812076c2d9.tar.gz rails-c99e673902539a0bb1762a8786671f812076c2d9.tar.bz2 rails-c99e673902539a0bb1762a8786671f812076c2d9.zip |
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.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/stack.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index f875aa5e6b..b9088e6d86 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -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 diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index b82f8aa3a3..7a2fcd6db7 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -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 |