Class YARD::Tags::MethodDirective
In: lib/yard/tags/directives.rb
Parent: Directive

Defines a method object with a given method signature, using indented block data as the method‘s docstring. The signature is similar to the {tag: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 {tag:!attribute}

@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.

@example 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

@example Attaching multiple methods to the same source

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

@see tag:!attribute @since 0.7.0

Methods

Constants

SCOPE_MATCH = /\A\s*self\s*\.\s*/

Public Instance methods

Protected Instance methods

[Validate]