class RDoc::Parser::PrismRuby::RDocVisitor
def visit_singleton_class_node(node)
def visit_singleton_class_node(node) @scanner.process_comments_until(node.location.start_line - 1) if @scanner.has_modifier_nodoc?(node.location.start_line) # Skip visiting inside the singleton class. Also skips creation of node.expression as a module @scanner.skip_comments_until(node.location.end_line) return end expression = node.expression expression = expression.body.body.first if expression.is_a?(Prism::ParenthesesNode) && expression.body&.body&.size == 1 case expression when Prism::ConstantWriteNode # Accept `class << (NameErrorCheckers = Object.new)` as a module which is not actually a module mod = @scanner.container.add_module(RDoc::NormalModule, expression.name.to_s) when Prism::ConstantPathNode, Prism::ConstantReadNode expression_name = constant_path_string(expression) # If a constant_path does not exist, RDoc creates a module mod = @scanner.find_or_create_module_path(expression_name, :module) if expression_name when Prism::SelfNode mod = @scanner.container if @scanner.container != @top_level end expression.accept(self) if mod @scanner.with_container(mod, singleton: true) do node.body&.accept(self) @scanner.process_comments_until(node.location.end_line) end else @scanner.skip_comments_until(node.location.end_line) end end