1
0
Fork 0
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:
Rafael França 2019-12-18 12:25:26 -03:00 committed by GitHub
commit 08764b1def
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.