From f9b499d89f34b6af8e32891686097ac2c01ea9b2 Mon Sep 17 00:00:00 2001 From: taki Date: Tue, 10 Mar 2020 00:39:17 +0900 Subject: [PATCH] Implement Module#namespace_name --- lib/pry-doc/pry_ext/method_info.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pry-doc/pry_ext/method_info.rb b/lib/pry-doc/pry_ext/method_info.rb index 22f5d586..72817692 100644 --- a/lib/pry-doc/pry_ext/method_info.rb +++ b/lib/pry-doc/pry_ext/method_info.rb @@ -115,7 +115,7 @@ def find_gem_dir(meth) host_source_location, _ = WrappedModule.new(host).source_location break if host_source_location != nil return unless host.name - host = eval(host.namespace_name) + host = eval(namespace_name(host)) end while host # We want to exclude all source_locations that aren't gems (i.e @@ -186,6 +186,12 @@ def cache(meth) YARD.parse(file) end end + + private + + def namespace_name(host) + host.name.split("::")[0..-2].join("::") + end end end end