summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Irwin <conrad.irwin@gmail.com>2012-02-28 06:43:49 -0800
committerConrad Irwin <conrad.irwin@gmail.com>2012-02-28 06:44:22 -0800
commit1da46f4507dce59ec414c03d14eda9f942cb8fba (patch)
tree212528c79cc06016b8629ab701d82d28ce0aab34
parent3577133c6547eab5e909241adff9aeeba9263f24 (diff)
downloadmethod_source-1da46f4507dce59ec414c03d14eda9f942cb8fba.tar.gz
Fix in the case of overridden method method
-rw-r--r--lib/method_source/source_location.rb4
1 files 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