aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2019-03-10 16:31:15 +0100
committerGitHub <noreply@github.com>2019-03-10 16:31:15 +0100
commitc87f6841b77e5827ca7bd03a629e2d615fae0d06 (patch)
tree8e62191b003d0dd096578566f891b66449191a57 /actionpack
parent08a93efab6bdf10ba7afafb6e51f4b7809c97ebc (diff)
parentc99e673902539a0bb1762a8786671f812076c2d9 (diff)
downloadrails-c87f6841b77e5827ca7bd03a629e2d615fae0d06.tar.gz
rails-c87f6841b77e5827ca7bd03a629e2d615fae0d06.tar.bz2
rails-c87f6841b77e5827ca7bd03a629e2d615fae0d06.zip
Merge pull request #35121 from utilum/warning_tried_to_create_proc_without_block
Ruby 2.7 warning: creating a Proc without a block
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal.rb4
-rw-r--r--actionpack/lib/action_dispatch/middleware/stack.rb4
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