{
    "mode": "ri",
    "parameter": "RDoc::Parser::Ruby",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/ri/RDoc%3A%3AParser%3A%3ARuby/json",
    "generated": "2026-06-02T15:09:14Z",
    "sections": {
        "RDoc::Parser::Ruby < RDoc::Parser": {
            "content": "------------------------------------------------------------------------",
            "subsections": []
        },
        "Includes:": {
            "content": "(from gem rdoc-7.2.0)\nRDoc::TokenStream\nRDoc::Parser::RubyTools\n\n(from gem rdoc-7.2.0)\n------------------------------------------------------------------------\nExtracts code elements from a source file returning a TopLevel object\ncontaining the constituent file elements.\n\nThis file is based on rtags\n\nRubyParser understands how to document:\n* classes\n* modules\n* methods\n* constants\n* aliases\n* private, public, protected\n* privateclassfunction, publicclassfunction\n* privateconstant, publicconstant\n* modulefunction\n* attr, attrreader, attrwriter, attraccessor\n* extra accessors given on the command line\n* metaprogrammed methods\n* require\n* include\n",
            "subsections": [
                {
                    "name": "Method Arguments",
                    "content": "The parser extracts the arguments from the method definition.  You can\noverride this with a custom argument definition using the :call-seq:\ndirective:\n\n##\n# This method can be called with a range or an offset and length\n#\n# :call-seq:\n#   mymethod(Range)\n#   mymethod(offset, length)\n\ndef mymethod(*args)\nend\n\nThe parser extracts yield expressions from method bodies to gather the\nyielded argument names.  If your method manually calls a block instead\nof yielding or you want to override the discovered argument names use\nthe :yields: directive:\n\n##\n# My method is awesome\n\ndef mymethod(&block) # :yields: happy, times\nblock.call 1, 2\nend\n"
                },
                {
                    "name": "Metaprogrammed Methods",
                    "content": "To pick up a metaprogrammed method, the parser looks for a comment\nstarting with '##' before an identifier:\n\n##\n# This is a meta-programmed method!\n\naddmymethod :metamethod, :arg1, :arg2\n\nThe parser looks at the token after the identifier to determine the\nname, in this example, :metamethod.  If a name cannot be found, a\nwarning is printed and 'unknown' is used.\n\nYou can force the name of a method using the :method: directive:\n\n##\n# :method: somemethod!\n\nBy default, meta-methods are instance methods.  To indicate that a\nmethod is a singleton method instead use the :singleton-method:\ndirective:\n\n##\n# :singleton-method:\n\nYou can also use the :singleton-method: directive with a name:\n\n##\n# :singleton-method: somemethod!\n\nYou can define arguments for metaprogrammed methods via either the\n:call-seq:, :arg: or :args: directives.\n\nAdditionally you can mark a method as an attribute by using :attr:,\n:attrreader:, :attrwriter: or :attraccessor:.  Just like for\n:method:, the name is optional.\n\n##\n# :attrreader: myattrname\n"
                },
                {
                    "name": "Hidden methods and attributes",
                    "content": "You can provide documentation for methods that don't appear using the\n:method:, :singleton-method: and :attr: directives:\n\n##\n# :attrwriter: ghostwriter\n# There is an attribute here, but you can't see it!\n\n##\n# :method: ghostmethod\n# There is a method here, but you can't see it!\n\n##\n# this is a comment for a regular method\n\ndef regularmethod() end\n\nNote that by default, the :method: directive will be ignored if there is\na standard rdocable item following it.\n------------------------------------------------------------------------"
                }
            ]
        },
        "Constants:": {
            "content": "NORMAL:\nRDoc::NormalClass type\n\nSINGLE:\nRDoc::SingleClass type\n\n",
            "subsections": []
        },
        "Class methods:": {
            "content": "new\n",
            "subsections": []
        },
        "Instance methods:": {
            "content": "collectfirstcomment\nerror\ngetbool\ngetclassormodule\ngetclassspecification\ngetconstant\ngetincludedmodulewithoptionalparens\ngetsymbolorname\nlookfordirectivesin\nmakemessage\nnewcomment\nparsealias\nparseattr\nparseattraccessor\nparsecallparameters\nparseclass\nparseclassregular\nparsecomment\nparsecommentghost\nparsecommenttomdoc\nparseconstant\nparseconstantvisibility\nparsemetaattr\nparsemetamethod\nparsemethod\nparsemethoddummy\nparsemethodoryieldparameters\nparsemethodparameters\nparsemethodparamsandbody\nparsemodule\nparserequire\nparserescue\nparsestatements\nparsesymbolarg\nparsesymbolinarg\nparsetoplevelstatements\nparsevisibility\nparseyield\nreaddirective\nreaddocumentationmodifiers\nretrievecommentbody\nscan\nskipforvariable\nskipmethod\nskipoptionaldoafterexpression\nskipparentheses\nskiptkspacecomment\ntknl?\nwarn\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}