From 52c65608c0cbd2a808cef249c5d0147075c43ad4 Mon Sep 17 00:00:00 2001 From: Alexander Baygeldin Date: Thu, 21 Apr 2022 21:50:10 +0300 Subject: [PATCH] build: Remove support for Ruby 2.6 (EOL) --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- lib/tantiny/index.rb | 7 +------ spec/tantiny/index_spec.rb | 5 +++-- tantiny.gemspec | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 368bc5b..65f2cda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: ruby: - - 2.6 + - 2.7 - 3.1 steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd3667b..6024a06 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,7 +69,7 @@ jobs: strategy: matrix: - ruby: ['2.6', '2.7', '3.0', '3.1'] + ruby: ['2.7', '3.0', '3.1'] os: ['ubuntu-latest', 'macos-latest'] permissions: diff --git a/lib/tantiny/index.rb b/lib/tantiny/index.rb index e673252..37574e8 100644 --- a/lib/tantiny/index.rb +++ b/lib/tantiny/index.rb @@ -97,12 +97,7 @@ def search(query, limit: DEFAULT_LIMIT, **smart_query_options) Query::TYPES.each do |query_type| method_name = "#{query_type}_query" define_method(method_name) do |*args, **kwargs| - # Ruby 2.6 fix (https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) - if kwargs.empty? - Query.send(method_name, self, *args) - else - Query.send(method_name, self, *args, **kwargs) - end + Query.send(method_name, self, *args, **kwargs) end end diff --git a/spec/tantiny/index_spec.rb b/spec/tantiny/index_spec.rb index 3d93eeb..cd5c0dc 100644 --- a/spec/tantiny/index_spec.rb +++ b/spec/tantiny/index_spec.rb @@ -293,10 +293,11 @@ def documents describe ".#{method_name}" do it "forwards args to Query" do any_args = [1, 2, 3] + any_kwargs = {foo: :bar} - expect(Tantiny::Query).to receive(method_name).with(index, *any_args) + expect(Tantiny::Query).to receive(method_name).with(index, *any_args, **any_kwargs) - index.send(method_name, *any_args) + index.send(method_name, *any_args, **any_kwargs) end end end diff --git a/tantiny.gemspec b/tantiny.gemspec index a7f1b6e..eb86441 100644 --- a/tantiny.gemspec +++ b/tantiny.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| "source_code_uri" => "https://github.com/baygeldin/tantiny" } - spec.required_ruby_version = ">= 2.6" + spec.required_ruby_version = ">= 2.7" spec.files = [ Dir.glob("bin/**/*"),