Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyrax::Transactions::Transaction#with_step_args Ruby 3 compatibility #6021

Merged
merged 1 commit into from
Apr 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/hyrax/transactions/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def initialize(container: Container, steps:)
def call(value)
Success(
steps.inject(value) do |val, step_name|
yield container[step_name].call(val, *step_arguments_for(step_name))
args = step_arguments_for(step_name)
yield container[step_name].call(val, *args[0..-2], **Hash(args[-1]))
end
)
end
Expand All @@ -119,7 +120,7 @@ def call(value)
# tx = Hyrax::Transactions::Transaction.new(steps: [:first_step, :second_step])
# result = tx.with_step_args(second_step: {named_parameter: :param_value}).call(:value)
#
def with_step_args(args)
def with_step_args(**args)
raise(ArgumentError, key_err_msg(args.keys)) if
args.keys.any? { |key| !step?(key) }

Expand Down