Merge pull request #38106 from jfine/change-meth-to-method

Switch to standardized argument name
This commit is contained in:
Rafael França 2019-12-27 15:22:03 -03:00 committed by GitHub
commit 092e8a0dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -57,22 +57,22 @@ module AbstractController
# ==== Parameters
# * <tt>method[, method]</tt> - A name or names of a method on the controller
# to be made available on the view.
def helper_method(*meths)
meths.flatten!
self._helper_methods += meths
def helper_method(*methods)
methods.flatten!
self._helper_methods += methods
location = caller_locations(1, 1).first
file, line = location.path, location.lineno
meths.each do |meth|
methods.each do |method|
_helpers.class_eval <<-ruby_eval, file, line
def #{meth}(*args, **kwargs, &blk) # def current_user(*args, **kwargs, &blk)
if kwargs.empty? # if kwargs.empty?
controller.send(%(#{meth}), *args, &blk) # controller.send(:current_user, *args, &blk)
else # else
controller.send(%(#{meth}), *args, **kwargs, &blk) # controller.send(:current_user, *args, **kwargs, &blk)
end # end
end # end
def #{method}(*args, **kwargs, &blk) # def current_user(*args, **kwargs, &blk)
if kwargs.empty? # if kwargs.empty?
controller.send(%(#{method}), *args, &blk) # controller.send(:current_user, *args, &blk)
else # else
controller.send(%(#{method}), *args, **kwargs, &blk) # controller.send(:current_user, *args, **kwargs, &blk)
end # end
end # end
ruby_eval
end
end