Skip to content

Commit 16506ee

Browse files
timrogersiMacTia
andauthored
Add support for Ruby 3.2.0 in Faraday v1.x (#1483)
* Run tests against Ruby 3.2 * Declare `DependencyLoader#new` with `ruby2_keywords` to fix Ruby 3.2.0 When adding a middleware that receives keyword arguments in the constructor, the call from `DependencyLoader#new` fails because the method is not defined using `ruby2_keywords`. This adds the required `ruby2_keywords` declaration to `DependencyLoader#new`, fixing the tests and getting Faraday v1.x working with Ruby 3.2.0. Fixes #1479. Co-authored-by: Matt <[email protected]>
1 parent d72db28 commit 16506ee

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
45+
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
4646

4747
steps:
4848
- uses: actions/checkout@v1

lib/faraday/dependency_loader.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require 'ruby2_keywords'
4+
35
module Faraday
46
# DependencyLoader helps Faraday adapters and middleware load dependencies.
57
module DependencyLoader
@@ -13,7 +15,7 @@ def dependency(lib = nil)
1315
self.load_error = e
1416
end
1517

16-
def new(*)
18+
ruby2_keywords def new(*)
1719
unless loaded?
1820
raise "missing dependency for #{self}: #{load_error.message}"
1921
end

0 commit comments

Comments
 (0)