mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #38023 from Shopify/ruby-2.7-delegation
Use new `...` syntax in Module#delegate if it's available
This commit is contained in:
commit
08764b1def
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