Skip to content

Commit

Permalink
Merge pull request #90 from radarek/release-0.9
Browse files Browse the repository at this point in the history
Update passthrough parameters list to support ruby 3.2.1
  • Loading branch information
flash-gordon authored Nov 12, 2023
2 parents 155108b + 04a7074 commit 5c7b30f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/dry/auto_inject/method_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ module Dry
module AutoInject
# @api private
class MethodParameters
PASS_THROUGH = [[%i[rest]], [%i[rest], %i[keyrest]]].freeze
PASS_THROUGH = [
[%i[rest]],
[%i[rest], %i[keyrest]],
[%i[rest *]],
[%i[rest *], %i[keyrest **]]
].freeze

def self.of(obj, name)
Enumerator.new do |y|
Expand Down
6 changes: 5 additions & 1 deletion spec/unit/method_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ def initialize(*)
all_parameters = parameters.of(klass, :initialize).to_a

expect(all_parameters.size).to eq 2
expect(all_parameters[0].parameters).to eql([[:rest]])
if RUBY_VERSION >= "3.2"
expect(all_parameters[0].parameters).to eql([[:rest, :*]])
else
expect(all_parameters[0].parameters).to eql([[:rest]])
end
expect(all_parameters[1]).to be_empty
end
end
Expand Down

0 comments on commit 5c7b30f

Please sign in to comment.