Skip to content

Commit

Permalink
Merge pull request #97 from taki/pass-spec
Browse files Browse the repository at this point in the history
Fix NoMethodError: undefined method `namespace_name' for Sample::A::B:Module
  • Loading branch information
kyrylo committed Mar 26, 2020
2 parents ee0b698 + f9b499d commit 599544a
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 599544a

Please sign in to comment.