From 5819813d97265b6b062437f14b91e78bcdee6d05 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 3 Nov 2022 11:54:08 +1300 Subject: [PATCH] Restore compatibility with Ruby v2.7.0. --- .github/workflows/test.yaml | 2 +- console.gemspec | 2 +- lib/console/progress.rb | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index df6c407..ccb6a70 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,7 +21,7 @@ jobs: - macos ruby: - - "2.7.3" + - "2.7.0" - "2.7" - "3.0" - "3.1" diff --git a/console.gemspec b/console.gemspec index f20efa4..16ca8c0 100644 --- a/console.gemspec +++ b/console.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| spec.files = Dir.glob(['{bake,lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__) - spec.required_ruby_version = ">= 2.7.3" + spec.required_ruby_version = ">= 2.7" spec.add_dependency "fiber-local" diff --git a/lib/console/progress.rb b/lib/console/progress.rb index 4880ec9..6220299 100644 --- a/lib/console/progress.rb +++ b/lib/console/progress.rb @@ -73,8 +73,14 @@ def resize(total) return self end - def mark(...) - @output.info(@subject, ...) + if RUBY_VERSION >= '2.7.3' + def mark(...) + @output.info(@subject, ...) + end + else + def mark(*arguments, **options, &block) + @output.info(@subject, *arguments, **options, &block) + end end def to_s