rdoc
rdoc copied to clipboard
Class.new's internal method becomes the method of the class to which the method belongs
The methods owned by the dynamically generated class inside the method are defined as the methods of the class outside of it. The explanation is a bit complicated, so please see the example.
aaa.rb:
class AAA
def bbb
Class.new do
def ccc; end
end
end
end
$ rdoc aaa.rb
There are both bbb and ccc as Public Instance Methods of class AAA.

$ rdoc --version
6.3.1
$ ruby --version
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]
Thank you.