From 1da46f4507dce59ec414c03d14eda9f942cb8fba Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 28 Feb 2012 06:43:49 -0800 Subject: Fix in the case of overridden method method --- lib/method_source/source_location.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/method_source/source_location.rb b/lib/method_source/source_location.rb index faa96c7..9161854 100644 --- a/lib/method_source/source_location.rb +++ b/lib/method_source/source_location.rb @@ -122,14 +122,14 @@ module MethodSource end begin - klass.allocate.method(name).source_location + Object.instance_method(:method).bind(klass.allocate).call(name).source_location rescue TypeError # Assume we are dealing with a Singleton Class: # 1. Get the instance object # 2. Forward the source_location lookup to the instance instance ||= ObjectSpace.each_object(owner).first - instance.method(name).source_location + Object.instance_method(:method).bind(instance).call(name).source_location end end end -- cgit v1.2.1