1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #29191 from bogdanvlviv/pass_params_filename_lineno_to_class_eval

Pass params __FILE__ and __LINE__ + 1 if class_eval with <<
This commit is contained in:
Kasper Timm Hansen 2017-05-29 22:11:53 +02:00 committed by GitHub
commit bd40038533
2 changed files with 6 additions and 6 deletions

View file

@ -10,11 +10,11 @@ module ActionDispatch
module VerbMatchers
VERBS = %w{ DELETE GET HEAD OPTIONS LINK PATCH POST PUT TRACE UNLINK }
VERBS.each do |v|
class_eval <<-eoc
class #{v}
def self.verb; name.split("::").last; end
def self.call(req); req.#{v.downcase}?; end
end
class_eval <<-eoc, __FILE__, __LINE__ + 1
class #{v}
def self.verb; name.split("::").last; end
def self.call(req); req.#{v.downcase}?; end
end
eoc
end

View file

@ -71,7 +71,7 @@ module ActionView
def helper_method(*methods)
# Almost a duplicate from ActionController::Helpers
methods.flatten.each do |method|
_helpers.module_eval <<-end_eval
_helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1
def #{method}(*args, &block) # def current_user(*args, &block)
_test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block)
end # end