From 78b0edb95d191e2001937c7308cd1bbd8e069aaa Mon Sep 17 00:00:00 2001 From: ya-luotao Date: Mon, 11 May 2026 01:00:06 +0800 Subject: [PATCH] Raise minimum Ruby to 3.1; CI now covers 3.1-3.5 + head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops Ruby 3.0 (EOL since March 2024, no upstream security patches) from required_ruby_version, the CI matrix, and rubocop's TargetRubyVersion. The matrix now spans 3.1, 3.2, 3.3, 3.4, 3.5, plus `head` (4.0 development branch) as a continue-on-error early-warning smoke test. Bumping TargetRubyVersion to 3.1 unlocked Naming/BlockForwarding and Style/ArgumentsForwarding, which surfaced `&block` patterns in Services::CommandHandle. Replaced with the anonymous form (`&`). This is a breaking change for anyone still running on Ruby 3.0 — the next release should be 0.4.0 rather than 0.3.6. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 5 ++++- .rubocop.yml | 2 +- CHANGELOG.md | 8 ++++++++ e2b.gemspec | 2 +- lib/e2b/services/command_handle.rb | 14 +++++++------- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1059641..d2af8a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,13 @@ jobs: test: name: rake (Ruby ${{ matrix.ruby }}) runs-on: ubuntu-latest + # `head` tracks Ruby's main branch (currently 4.0 development) and is + # allowed to fail without blocking — it's an early-warning smoke test. + continue-on-error: ${{ matrix.ruby == 'head' }} strategy: fail-fast: false matrix: - ruby: ["3.0", "3.1", "3.2", "3.3"] + ruby: ["3.1", "3.2", "3.3", "3.4", "3.5", "head"] steps: - uses: actions/checkout@v4 diff --git a/.rubocop.yml b/.rubocop.yml index 811826b..605a2c7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 NewCops: enable SuggestExtensions: false Exclude: diff --git a/CHANGELOG.md b/CHANGELOG.md index 811b60c..11e5875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to the E2B Ruby SDK will be documented in this file. ## [Unreleased] +### Changed + +- **Minimum Ruby version raised to 3.1** (was 3.0). Ruby 3.0 reached end-of-life in March 2024 and is no longer covered by upstream security patches. The CI matrix now spans 3.1, 3.2, 3.3, 3.4, 3.5, plus Ruby `head` (4.0 development branch, allowed to fail) as an early-warning smoke test. + +### Internal + +- Adopted Ruby 3.1 anonymous block forwarding (`&` instead of `&block`) in `Services::CommandHandle` after the `TargetRubyVersion` bump unlocked the relevant cops. + ## [0.3.5] - 2026-05-10 ### Fixed diff --git a/e2b.gemspec b/e2b.gemspec index 6758951..a18802c 100644 --- a/e2b.gemspec +++ b/e2b.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| DESC spec.homepage = "https://github.com/ya-luotao/e2b-ruby" spec.license = "MIT" - spec.required_ruby_version = ">= 3.0.0" + spec.required_ruby_version = ">= 3.1.0" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://github.com/ya-luotao/e2b-ruby" diff --git a/lib/e2b/services/command_handle.rb b/lib/e2b/services/command_handle.rb index 3040789..9c340fd 100644 --- a/lib/e2b/services/command_handle.rb +++ b/lib/e2b/services/command_handle.rb @@ -243,15 +243,15 @@ def disconnect # @yieldparam stderr [String, nil] Stderr data, or nil # @yieldparam pty [String, nil] PTY data, or nil # @return [void] - def each(&block) + def each(&) return enum_for(:each) unless block_given? if @result # Iterate over pre-materialized events - iterate_materialized_events(&block) + iterate_materialized_events(&) elsif @events_proc # Iterate over streaming events - iterate_streaming_events(&block) + iterate_streaming_events(&) end end @@ -298,7 +298,7 @@ def build_result # # @yield [stdout, stderr, pty] # @return [void] - def iterate_materialized_events(&block) + def iterate_materialized_events(&) events = result_value(:events) || [] while @materialized_event_index < events.length break if @disconnected @@ -306,7 +306,7 @@ def iterate_materialized_events(&block) event_hash = events[@materialized_event_index] @materialized_event_index += 1 - process_message(event_hash, &block) + process_message(event_hash, &) end end @@ -341,11 +341,11 @@ def iterate_streaming_events(&block) # @param message [Hash] A raw stream message # @yield [stdout, stderr, pty] # @return [void] - def process_message(message, &block) + def process_message(message, &) return unless message.is_a?(Hash) event = message["event"] - process_event(event, &block) if event.is_a?(Hash) + process_event(event, &) if event.is_a?(Hash) if event.nil? stdout_chunk = EnvdBase64.decode_process_output(message["stdout"])