aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/delegation.rb
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2014-01-16 10:45:53 +0100
committerPiotr Sarnacki <drogus@gmail.com>2014-01-16 10:45:53 +0100
commitfbab7b2acc1db4b8f1a9212350721b7716e74ac8 (patch)
tree6169826547edb7e3e61a88f79ebef1960d44398f /activesupport/lib/active_support/core_ext/module/delegation.rb
parent2e0f9ed76eed8132ce49e672694a3d53baf38b6f (diff)
downloadrails-fbab7b2acc1db4b8f1a9212350721b7716e74ac8.tar.gz
rails-fbab7b2acc1db4b8f1a9212350721b7716e74ac8.tar.bz2
rails-fbab7b2acc1db4b8f1a9212350721b7716e74ac8.zip
Revert "methods are defined right after the module_eval, so we don't need to do"
This change breaks tests in activesupport/test/core_ext/module_test.rb: * test_delegation_exception_backtrace * test_delegation_exception_backtrace_with_allow_nil This reverts commit 0167765e3f84260522bc2f32d926c1f5dd44957c.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/delegation.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index 7f1f393705..58146cdf7a 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -178,7 +178,7 @@ class Module
# whereas conceptually, from the user point of view, the delegator should
# be doing one call.
if allow_nil
- module_eval(<<-EOS, file, line)
+ module_eval(<<-EOS, file, line - 3)
def #{method_prefix}#{method}(#{definition}) # def customer_name(*args, &block)
_ = #{to} # _ = client
if !_.nil? || nil.respond_to?(:#{method}) # if !_.nil? || nil.respond_to?(:name)
@@ -189,7 +189,7 @@ class Module
else
exception = %(raise DelegationError, "#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}")
- module_eval(<<-EOS, file, line)
+ module_eval(<<-EOS, file, line - 2)
def #{method_prefix}#{method}(#{definition}) # def customer_name(*args, &block)
_ = #{to} # _ = client
_.#{method}(#{definition}) # _.name(*args, &block)