Method: YARD::DocstringParser#parse

Defined in:
lib/yard/docstring_parser.rb

#parse(content, object = nil, handler = nil) ⇒ self

Parses all content and returns itself.

Parameters:

  • content (String)

    the docstring text to parse

  • object (CodeObjects::Base) (defaults to: nil)

    the object that the docstring is attached to. Will be passed to directives to act on this object.

  • handler (Handlers::Base, nil) (defaults to: nil)

    the handler object that is parsing this object. May be nil if this parser is not being called from a Parser::SourceParser context.

Returns:

  • (self)

    the parser object. To get the docstring, call #to_docstring.

See Also:

Since:

  • 0.8.0



112
113
114
115
116
117
118
119
120
121
# File 'lib/yard/docstring_parser.rb', line 112

def parse(content, object = nil, handler = nil)
  @object = object
  @handler = handler
  @reference, @raw_text = detect_reference(content)
  text = parse_content(@raw_text)
  @text = text.strip
  call_directives_after_parse
  post_process
  self
end