class RDoc::Parser::PrismRuby::RDocVisitor
def visit_def_node(node)
def visit_def_node(node) start_line = node.location.start_line end_line = node.location.end_line @scanner.process_comments_until(start_line - 1) case node.receiver when Prism::NilNode, Prism::TrueNode, Prism::FalseNode visibility = :public singleton = false receiver_name = case node.receiver when Prism::NilNode 'NilClass' when Prism::TrueNode 'TrueClass' when Prism::FalseNode 'FalseClass' end receiver_fallback_type = :class when Prism::SelfNode # singleton method of a singleton class is not documentable return if @scanner.singleton visibility = :public singleton = true when Prism::ConstantReadNode, Prism::ConstantPathNode visibility = :public singleton = true receiver_name = constant_path_string(node.receiver) receiver_fallback_type = :module return unless receiver_name when nil visibility = @scanner.visibility singleton = @scanner.singleton else # `def (unknown expression).method_name` is not documentable return end name = node.name.to_s params, block_params, calls_super = MethodSignatureVisitor.scan_signature(node) tokens = @scanner.visible_tokens_from_location(node.location) @scanner.add_method( name, receiver_name: receiver_name, receiver_fallback_type: receiver_fallback_type, visibility: visibility, singleton: singleton, params: params, block_params: block_params, calls_super: calls_super, tokens: tokens, start_line: start_line, end_line: end_line ) ensure @scanner.skip_comments_until(end_line) end