Skip to content

Update README with minimal ruby (3.1) and s/match/match? - #204

Merged
Keith-wright merged 1 commit into
pusher:masterfrom
esparta:ruby3.aware
Aug 5, 2026
Merged

Update README with minimal ruby (3.1) and s/match/match?#204
Keith-wright merged 1 commit into
pusher:masterfrom
esparta:ruby3.aware

Conversation

@esparta

@esparta esparta commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

In #200 the gemspec file was changed to enforce the requirement of a minimal version of ruby 3.1, this change was not reflected on the README.md which still suggest that the gem supports ruby 2.6 and above.

Took the opportunity to also change the use of Regex#match? instead of Regex#match, this change will gain a performance improvement - it was added in ruby 2.4, specially in Pusher::Channel class. If required I can open up a new PR about that.

micro-benchmark:

# spec/benchmark.rb

require 'benchmark'
require_relative 'spec_helper'
require 'pusher'

puts Benchmark.measure {
  500_000.times do
    Pusher::Channel.new('nl', 'yo', nil)
end

before

ruby spec/benchmark.rb
  0.342884   0.000089   0.342973 (  0.344086)

after

ruby spec/benchmark.rb
  0.272801   0.000000   0.272801 (  0.273464),

CHANGELOG

  • [CHANGED] Change README.md to reflect the minimal version supported
  • [CHANGED] use Regex#match? instead of Regex#match to improve overall performance of the gem

Notes

I didn't add the benchmark file, I can do that if the maintainers consider it worthy

puts Benchmark.measure {
  500_000.times do
    Pusher::Channel.new('nl', 'yo', nil)
end

before

root@7f8cea552134:/src# ruby spec/benchmark.rb
  0.342884   0.000089   0.342973 (  0.344086)

after

ruby spec/benchmark.rb
  0.272801   0.000000   0.272801 (  0.273464)
@Keith-wright
Keith-wright merged commit 97b4912 into pusher:master Aug 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants