Skip to content

Commit

Permalink
All intermediate delegation methods should preserve kwargs flag
Browse files Browse the repository at this point in the history
Since ruby/ruby@0456826,
`foo(*caller_args)` method call delegation no longer preserve kwargs
flag.

Fixes #44846.
  • Loading branch information
kamipo committed Apr 6, 2022
1 parent 22ca875 commit 714fd07
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -624,6 +624,7 @@ def process(method_name, *args) # :nodoc:
@_message = NullMail.new unless @_mail_was_called
end
end
ruby2_keywords(:process)

class NullMail # :nodoc:
def body; "" end
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/lib/action_mailer/rescuable.rb
Expand Up @@ -20,7 +20,7 @@ def handle_exceptions # :nodoc:
end

private
def process(*)
def process(...)
handle_exceptions do
super
end
Expand Down
5 changes: 3 additions & 2 deletions actionpack/lib/abstract_controller/base.rb
Expand Up @@ -155,6 +155,7 @@ def process(action, *args)

process_action(action_name, *args)
end
ruby2_keywords(:process)

# Delegates to the class's ::controller_path.
def controller_path
Expand Down Expand Up @@ -215,8 +216,8 @@ def action_method?(name)
#
# Notice that the first argument is the method to be dispatched
# which is *not* necessarily the same as the action name.
def process_action(method_name, *args)
send_action(method_name, *args)
def process_action(...)
send_action(...)
end

# Actually call the method associated with the action. Override
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/abstract_controller/callbacks.rb
Expand Up @@ -244,7 +244,7 @@ def _insert_callbacks(callbacks, block = nil)
private
# Override <tt>AbstractController::Base#process_action</tt> to run the
# <tt>process_action</tt> callbacks around the normal behavior.
def process_action(*)
def process_action(...)
run_callbacks(:process_action) do
super
end
Expand Down
2 changes: 1 addition & 1 deletion actionview/lib/action_view/rendering.rb
Expand Up @@ -34,7 +34,7 @@ def initialize
end

# Override process to set up I18n proxy.
def process(*) # :nodoc:
def process(...) # :nodoc:
old_config, I18n.config = I18n.config, I18nProxy.new(I18n.config, lookup_context)
super
ensure
Expand Down
1 change: 1 addition & 0 deletions activemodel/lib/active_model/attribute_methods.rb
Expand Up @@ -471,6 +471,7 @@ def method_missing(method, *args, &block)
def attribute_missing(match, *args, &block)
__send__(match.proxy_target, match.attr_name, *args, &block)
end
ruby2_keywords(:attribute_missing)

# A +Person+ instance with a +name+ attribute can ask
# <tt>person.respond_to?(:name)</tt>, <tt>person.respond_to?(:name=)</tt>,
Expand Down
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/relation.rb
Expand Up @@ -429,10 +429,10 @@ def scoping(all_queries: nil, &block)
end
end

def _exec_scope(*args, &block) # :nodoc:
def _exec_scope(...) # :nodoc:
@delegate_to_klass = true
registry = klass.scope_registry
_scoping(nil, registry) { instance_exec(*args, &block) || self }
_scoping(nil, registry) { instance_exec(...) || self }
ensure
@delegate_to_klass = false
end
Expand Down

0 comments on commit 714fd07

Please sign in to comment.