rdoc
rdoc copied to clipboard
Double class name before the top-level constant
Here's a minimal example:
$ exa -T
.
└── lib
└── main.rb
# lib/main.rb
def aaa
BBB ::CCC
end
And then I run RDoc ($ rdoc).
In the generated HTML, there is a doubling of the class that is placed before the top-level constant. The "top-level constant" here refers to the one at this link: https://docs.ruby-lang.org/en/master/doc/syntax/modules_and_classes_rdoc.html#label-Constants

This doesn't happen if the constant is enclosed in parentheses.
Here's a case that seems more likely to be real: Pathname ::ENV['HOME']
Using RDoc 6.2.1.
I reproduced it with below:
class Foo
def bar
Pathname ::ENV['HOME']
end
end
Then:
def bar
PathnamePathname::ENV['HOME']
end
And when I removed :: from ::ENV,
class Foo
def bar
Pathname ENV['HOME']
end
end
The problem is resolved:
def bar
Pathname ENV['HOME']
end
I suspect it's caused by a parser. I'll look into it.