Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoMethodError: undefined method `namespace_name' for Sample::A::B:Module #97

Merged
merged 1 commit into from Mar 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/pry-doc/pry_ext/method_info.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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