Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Proc#ruby2_keywords

() -> self
proc.ruby2_keywords → proc

Deprecated: will be removed in Ruby 4.4. Use explicit delegation (*args, **kwargs) instead; it works correctly on Ruby 3.0 and later. See bugs.ruby-lang.org/issues/22205 for the schedule.

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (*args) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

This should only be used for procs that delegate keywords to another method, and only for backwards compatibility with Ruby versions before 2.7.

Ruby version changes

  1. 4.1