mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use new ... syntax in Module#delegate if it's available
It was added in https://bugs.ruby-lang.org/issues/16253 It allows to do blind delegation without having to worry about ruby2_keywords, and suposedly is also a bit faster.
This commit is contained in:
parent
6da2152d60
commit
11ac92ef79
1 changed files with 7 additions and 1 deletions
|
@ -199,7 +199,13 @@ class Module
|
|||
|
||||
# Attribute writer methods only accept one argument. Makes sure []=
|
||||
# methods still accept two arguments.
|
||||
definition = /[^\]]=$/.match?(method) ? "arg" : "*args, &block"
|
||||
definition = if /[^\]]=$/.match?(method)
|
||||
"arg"
|
||||
elsif RUBY_VERSION >= "2.7"
|
||||
"..."
|
||||
else
|
||||
"*args, &block"
|
||||
end
|
||||
|
||||
# The following generated method calls the target exactly once, storing
|
||||
# the returned value in a dummy variable.
|
||||
|
|
Loading…
Reference in a new issue