lib/code.rb in code-0.9.3 vs lib/code.rb in code-0.9.4
- old
+ new
@@ -13,10 +13,15 @@
class NotFound < StandardError
end
# API for end user
def self.for(object = self, method_name)
- m = object.method(method_name)
+ if method_name.is_a?(Method) || method_name.is_a?(UnboundMethod)
+ m = method_name
+ else
+ m = object.method(method_name)
+ end
+
begin
from_ruby(m)
rescue MethodSource::SourceNotFoundError
from_docs(m)
end