It seems that RDoc does not yet support the endless method at this time.
Here is a small example:
lib/main.rb:
class AAA
def aaa = :aaa
end
class BBB; end
then $ rdoc produces following document:
- Class and Module Index
AAA
AAA::BBB (if correct, it is BBB)
- class
AAA's public instance methods: the following screenshot

In other words, the end of the range of method aaa is misidentified as the end of class AAA.
This doesn't happen if the method isn't defined as the endless method.
Using following versions:
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
$ rdoc -v
6.4.0
It seems that RDoc does not yet support the endless method at this time.
Here is a small example:
lib/main.rb:then
$ rdocproduces following document:AAAAAA::BBB(if correct, it isBBB)AAA's public instance methods: the following screenshotIn other words, the end of the range of method
aaais misidentified as theendof classAAA.This doesn't happen if the method isn't defined as the endless method.
Using following versions: