From 9d5f82e5eb5cc2dbab2784a321a9b79ed7606ef3 Mon Sep 17 00:00:00 2001 From: Alexey Zapparov Date: Sun, 15 Oct 2023 18:48:51 +0200 Subject: [PATCH] Drop ruby 2.x support --- .github/workflows/ci.yml | 4 ++-- .rubocop.yml | 2 +- README.md | 2 -- http.gemspec | 4 +--- lib/http/client.rb | 2 +- lib/http/content_type.rb | 4 ++-- lib/http/headers.rb | 4 ++-- lib/http/request.rb | 2 +- lib/http/request/writer.rb | 2 +- lib/http/uri.rb | 2 +- 10 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a4e4f7a..e7daa1fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - ruby: [ ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2 ] + ruby: [ ruby-3.0, ruby-3.1, ruby-3.2 ] os: [ ubuntu-latest ] steps: @@ -76,7 +76,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 + ruby-version: ruby-3.0 bundler-cache: true - name: bundle exec rubocop diff --git a/.rubocop.yml b/.rubocop.yml index e2956f84..f417a170 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,4 +8,4 @@ AllCops: DefaultFormatter: fuubar DisplayCopNames: true NewCops: enable - TargetRubyVersion: 2.6 + TargetRubyVersion: 3.0 diff --git a/README.md b/README.md index 5ac0c511..58c1294b 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,6 @@ This library aims to support and is [tested against][build-link] the following Ruby versions: - JRuby 9.3 -- Ruby 2.6 -- Ruby 2.7 - Ruby 3.0 - Ruby 3.1 - Ruby 3.2 diff --git a/http.gemspec b/http.gemspec index 995ce424..36b1d51b 100644 --- a/http.gemspec +++ b/http.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |gem| gem.require_paths = ["lib"] gem.version = HTTP::VERSION - gem.required_ruby_version = ">= 2.6" + gem.required_ruby_version = ">= 3.0" gem.add_runtime_dependency "addressable", "~> 2.8" gem.add_runtime_dependency "base64", "~> 0.1" @@ -33,8 +33,6 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency "http-form_data", "~> 2.2" gem.add_runtime_dependency "llhttp-ffi", "~> 0.5.0" - gem.add_development_dependency "bundler", "~> 2.0" - gem.metadata = { "source_code_uri" => "https://github.com/httprb/http", "wiki_uri" => "https://github.com/httprb/http/wiki", diff --git a/lib/http/client.rb b/lib/http/client.rb index af29f330..8894d0a2 100644 --- a/lib/http/client.rb +++ b/lib/http/client.rb @@ -16,7 +16,7 @@ class Client extend Forwardable include Chainable - HTTP_OR_HTTPS_RE = %r{^https?://}i.freeze + HTTP_OR_HTTPS_RE = %r{^https?://}i def initialize(default_options = {}) @default_options = HTTP::Options.new(default_options) diff --git a/lib/http/content_type.rb b/lib/http/content_type.rb index aa40d3a3..44757573 100644 --- a/lib/http/content_type.rb +++ b/lib/http/content_type.rb @@ -2,8 +2,8 @@ module HTTP class ContentType - MIME_TYPE_RE = %r{^([^/]+/[^;]+)(?:$|;)}.freeze - CHARSET_RE = /;\s*charset=([^;]+)/i.freeze + MIME_TYPE_RE = %r{^([^/]+/[^;]+)(?:$|;)} + CHARSET_RE = /;\s*charset=([^;]+)/i attr_accessor :mime_type, :charset diff --git a/lib/http/headers.rb b/lib/http/headers.rb index 104552f8..88ab4397 100644 --- a/lib/http/headers.rb +++ b/lib/http/headers.rb @@ -13,11 +13,11 @@ class Headers include Enumerable # Matches HTTP header names when in "Canonical-Http-Format" - CANONICAL_NAME_RE = /\A[A-Z][a-z]*(?:-[A-Z][a-z]*)*\z/.freeze + CANONICAL_NAME_RE = /\A[A-Z][a-z]*(?:-[A-Z][a-z]*)*\z/ # Matches valid header field name according to RFC. # @see http://tools.ietf.org/html/rfc7230#section-3.2 - COMPLIANT_NAME_RE = /\A[A-Za-z0-9!#$%&'*+\-.^_`|~]+\z/.freeze + COMPLIANT_NAME_RE = /\A[A-Za-z0-9!#$%&'*+\-.^_`|~]+\z/ # Class constructor. def initialize diff --git a/lib/http/request.rb b/lib/http/request.rb index 39dd6b1c..b733e6d3 100644 --- a/lib/http/request.rb +++ b/lib/http/request.rb @@ -24,7 +24,7 @@ class UnsupportedMethodError < RequestError; end class UnsupportedSchemeError < RequestError; end # Default User-Agent header value - USER_AGENT = "http.rb/#{HTTP::VERSION}" + USER_AGENT = "http.rb/#{HTTP::VERSION}".freeze METHODS = [ # RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1 diff --git a/lib/http/request/writer.rb b/lib/http/request/writer.rb index b905cb9f..ce06c410 100644 --- a/lib/http/request/writer.rb +++ b/lib/http/request/writer.rb @@ -15,7 +15,7 @@ class Writer CHUNKED = "chunked" # End of a chunked transfer - CHUNKED_END = "#{ZERO}#{CRLF}#{CRLF}" + CHUNKED_END = "#{ZERO}#{CRLF}#{CRLF}".freeze def initialize(socket, body, headers, headline) @body = body diff --git a/lib/http/uri.rb b/lib/http/uri.rb index 9bc93adf..b890777f 100644 --- a/lib/http/uri.rb +++ b/lib/http/uri.rb @@ -38,7 +38,7 @@ class URI HTTPS_SCHEME = "https" # @private - PERCENT_ENCODE = /[^\x21-\x7E]+/.freeze + PERCENT_ENCODE = /[^\x21-\x7E]+/ # @private NORMALIZER = lambda do |uri|