From dbb6e92edefa1f9ec6d0f1a399fda40aa80b02d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Zanellato?= <30451287+AZanellato@users.noreply.github.com> Date: Wed, 15 Jun 2022 18:03:18 -0300 Subject: [PATCH 1/2] Update ruby2_keywords definition This needs to be on the top level so it can be called on the load --- elasticsearch-model/lib/elasticsearch/model/proxy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elasticsearch-model/lib/elasticsearch/model/proxy.rb b/elasticsearch-model/lib/elasticsearch/model/proxy.rb index 6fdf6632..72e8fbf2 100644 --- a/elasticsearch-model/lib/elasticsearch/model/proxy.rb +++ b/elasticsearch-model/lib/elasticsearch/model/proxy.rb @@ -14,7 +14,8 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - +def ruby2_keywords(*) # :nodoc: +end if RUBY_VERSION < "2.7" module Elasticsearch module Model From b1d34854e7cc42fb5e317afac3efd7a7dba7af1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Zanellato?= <30451287+AZanellato@users.noreply.github.com> Date: Wed, 15 Jun 2022 18:05:24 -0300 Subject: [PATCH 2/2] Remove old code --- elasticsearch-model/lib/elasticsearch/model/proxy.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/elasticsearch-model/lib/elasticsearch/model/proxy.rb b/elasticsearch-model/lib/elasticsearch/model/proxy.rb index 72e8fbf2..fa713e04 100644 --- a/elasticsearch-model/lib/elasticsearch/model/proxy.rb +++ b/elasticsearch-model/lib/elasticsearch/model/proxy.rb @@ -115,10 +115,7 @@ module Base def initialize(target) @target = target end - - def ruby2_keywords(*) # :nodoc: - end if RUBY_VERSION < "2.7" - + # Delegate methods to `@target`. As per [the Ruby 3.0 explanation for keyword arguments](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/), the only way to work on Ruby <2.7, and 2.7, and 3.0+ is to use `ruby2_keywords`. # ruby2_keywords def method_missing(method_name, *arguments, &block)