summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mair <jrmair@gmail.com>2012-02-28 06:52:30 -0800
committerJohn Mair <jrmair@gmail.com>2012-02-28 06:52:30 -0800
commit67754ab26f8dd89e57d9cd00674dfb96d0d50070 (patch)
tree212528c79cc06016b8629ab701d82d28ce0aab34
parent3577133c6547eab5e909241adff9aeeba9263f24 (diff)
parent1da46f4507dce59ec414c03d14eda9f942cb8fba (diff)
downloadmethod_source-67754ab26f8dd89e57d9cd00674dfb96d0d50070.tar.gz
Merge pull request #10 from ConradIrwin/master
Fix method_source in the case that the method method has been overridden on 1.8.7
-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