123456789_123456789_123456789_123456789_123456789_

Class: YARD::Tags::MethodDirective

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Directive
Instance Chain:
self, Directive
Inherits: YARD::Tags::Directive
Defined in: lib/yard/tags/directives.rb

Overview

Note:

This directive should only be used if there is no explicit declaration for the method in any source files (i.e., the method is declared dynamically via meta-programming). In all other cases, add documentation to the method definition itself.

Note:

For backwards compatibility support, you do not need to indent the method's docstring text. If a @!method directive is seen with no indented block, the entire docstring is used as the new method's docstring text.

Defines a method object with a given method signature, using indented block data as the method's docstring. The signature is similar to the @overload tag. The comment containing this directive does not need to be attached to any source, but if it is, that source code will be used as the method's source.

To define an attribute method, see @!attribute

Examples:

Defining a simple method

# @!method quit(username, message = "Quit")
#   Sends a quit message to the server for a +username+.
#   @param [String] username the username to quit
#   @param [String] message the quit message
quit_message_method

Attaching multiple methods to the same source

# @!method method1
# @!method method2
create_methods :method1, :method2

See Also:

Since:

  • 0.7.0

Constant Summary

Parser callbacks

Class Method Summary

Directive - Inherited

Instance Attribute Summary

Directive - Inherited

#expanded_text

Set this field to replace the directive definition inside of a docstring with arbitrary text.

#handler, #object, #tag

Instance Method Summary

Directive - Inherited

#after_parse

Called after parsing all directives and tags in the docstring.

#call

Called when processing the directive.

Constructor Details

This class inherits a constructor from YARD::Tags::Directive

Instance Method Details

#after_parse

Since:

  • 0.7.0

[ GitHub ]

  
# File 'lib/yard/tags/directives.rb', line 373

def after_parse
  return unless handler
  use_indented_text
  create_object
end

#call

Since:

  • 0.7.0

[ GitHub ]

  
# File 'lib/yard/tags/directives.rb', line 371

def call; end