From 0f1416cfd7e406300486b3b96b27ff8c6dabb4ac Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 15 Aug 2019 11:30:07 -0700 Subject: [PATCH] Fix warnings on Ruby 2.7 Ruby 2.7 emits warnings when using `Proc.new` with no block. This commit just converts the code to use `&block` to avoid the warning. --- lib/will_paginate/deprecation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/will_paginate/deprecation.rb b/lib/will_paginate/deprecation.rb index 848ecf8f1..21b167c09 100644 --- a/lib/will_paginate/deprecation.rb +++ b/lib/will_paginate/deprecation.rb @@ -31,8 +31,8 @@ def []=(key, value) super end - def deprecate_key(*keys) - message = block_given? ? Proc.new : keys.pop + def deprecate_key(*keys, &block) + message = block_given? ? block : keys.pop Array(keys).each { |key| @deprecated[key] = message } end