RDoc::Parser::Ruby - ri - phpman

Look up a command

 

Markdown Format | JSON API | MCP Server Tool


RDoc::Parser::Ruby
RDoc::Parser::Ruby < RDoc::Parser Includes: Constants: Class methods: Instance methods:
= RDoc::Parser::Ruby < RDoc::Parser

------------------------------------------------------------------------
= Includes:
(from gem rdoc-7.2.0)
  RDoc::TokenStream
  RDoc::Parser::RubyTools

(from gem rdoc-7.2.0)
------------------------------------------------------------------------
Extracts code elements from a source file returning a TopLevel object
containing the constituent file elements.

This file is based on rtags

RubyParser understands how to document:
* classes
* modules
* methods
* constants
* aliases
* private, public, protected
* private_class_function, public_class_function
* private_constant, public_constant
* module_function
* attr, attr_reader, attr_writer, attr_accessor
* extra accessors given on the command line
* metaprogrammed methods
* require
* include

== Method Arguments

The parser extracts the arguments from the method definition.  You can
override this with a custom argument definition using the :call-seq:
directive:

  ##
  # This method can be called with a range or an offset and length
  #
  # :call-seq:
  #   my_method(Range)
  #   my_method(offset, length)

  def my_method(*args)
  end

The parser extracts yield expressions from method bodies to gather the
yielded argument names.  If your method manually calls a block instead
of yielding or you want to override the discovered argument names use
the :yields: directive:

  ##
  # My method is awesome

  def my_method(&block) # :yields: happy, times
    block.call 1, 2
  end

== Metaprogrammed Methods

To pick up a metaprogrammed method, the parser looks for a comment
starting with '##' before an identifier:

  ##
  # This is a meta-programmed method!

  add_my_method :meta_method, :arg1, :arg2

The parser looks at the token after the identifier to determine the
name, in this example, :meta_method.  If a name cannot be found, a
warning is printed and 'unknown' is used.

You can force the name of a method using the :method: directive:

  ##
  # :method: some_method!

By default, meta-methods are instance methods.  To indicate that a
method is a singleton method instead use the :singleton-method:
directive:

  ##
  # :singleton-method:

You can also use the :singleton-method: directive with a name:

  ##
  # :singleton-method: some_method!

You can define arguments for metaprogrammed methods via either the
:call-seq:, :arg: or :args: directives.

Additionally you can mark a method as an attribute by using :attr:,
:attr_reader:, :attr_writer: or :attr_accessor:.  Just like for
:method:, the name is optional.

  ##
  # :attr_reader: my_attr_name

== Hidden methods and attributes

You can provide documentation for methods that don't appear using the
:method:, :singleton-method: and :attr: directives:

  ##
  # :attr_writer: ghost_writer
  # There is an attribute here, but you can't see it!

  ##
  # :method: ghost_method
  # There is a method here, but you can't see it!

  ##
  # this is a comment for a regular method

  def regular_method() end

Note that by default, the :method: directive will be ignored if there is
a standard rdocable item following it.
------------------------------------------------------------------------
= Constants:

NORMAL:
  RDoc::NormalClass type

SINGLE:
  RDoc::SingleClass type


= Class methods:

  new

= Instance methods:

  collect_first_comment
  error
  get_bool
  get_class_or_module
  get_class_specification
  get_constant
  get_included_module_with_optional_parens
  get_symbol_or_name
  look_for_directives_in
  make_message
  new_comment
  parse_alias
  parse_attr
  parse_attr_accessor
  parse_call_parameters
  parse_class
  parse_class_regular
  parse_comment
  parse_comment_ghost
  parse_comment_tomdoc
  parse_constant
  parse_constant_visibility
  parse_meta_attr
  parse_meta_method
  parse_method
  parse_method_dummy
  parse_method_or_yield_parameters
  parse_method_parameters
  parse_method_params_and_body
  parse_module
  parse_require
  parse_rescue
  parse_statements
  parse_symbol_arg
  parse_symbol_in_arg
  parse_top_level_statements
  parse_visibility
  parse_yield
  read_directive
  read_documentation_modifiers
  retrieve_comment_body
  scan
  skip_for_variable
  skip_method
  skip_optional_do_after_expression
  skip_parentheses
  skip_tkspace_comment
  tk_nl?
  warn


Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:17 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 TransitionalValid CSS!

^_back to top