RDoc::Parser - ri - phpman

Look up a command

 

Markdown Format | JSON API | MCP Server Tool


= RDoc::Parser < Object

(from gem rdoc-7.2.0)
------------------------------------------------------------------------
A parser is simple a class that subclasses RDoc::Parser and implements
#scan to fill in an RDoc::TopLevel with parsed data.

The initialize method takes an RDoc::TopLevel to fill with parsed
content, the name of the file to be parsed, the content of the file, an
RDoc::Options object and an RDoc::Stats object to inform the user of
parsed items.  The scan method is then called to parse the file and must
return the RDoc::TopLevel object.  By calling super these items will be
set for you.

In order to be used by RDoc the parser needs to register the file
extensions it can parse.  Use ::parse_files_matching to register
extensions.

  require 'rdoc'

  class RDoc::Parser::Xyz < RDoc::Parser
    parse_files_matching /\.xyz$/

    def initialize top_level, file_name, content, options, stats
      super

      # extra initialization if needed
    end

    def scan
      # parse file and fill in @top_level
    end
  end
------------------------------------------------------------------------
= Class methods:

  alias_extension
  binary?
  can_parse
  can_parse_by_name
  check_modeline
  for
  new
  parse_files_matching
  parsers
  remove_modeline
  use_markup
  zip?

= Instance methods:

  file_name
  handle_tab_width

= Attributes:

  attr_reader file_name
  attr_reader parsers


Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 06:18 @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!