cheat sheets.

$ command line ruby cheat sheets
YARD Documentation Syntax

Taken from:

I. Tags

@abstract: Marks a class/module/method as abstract with optional implementor information.

    @abstract Subclass and override {#run} to implement a custom Threadable class.

@author: List the author(s) of a class/method

    @author Full Name

@deprecated: Marks a method/class as deprecated with an optional reason.

    @deprecated Describe the reason or provide alt. references here

@example: Show an example snippet of code for an object. The first line is an optional title.

    @example Reverse a string
      "mystring.reverse" #=> "gnirtsym"

@option: Describe an options hash in a method. The tag takes the name of the options parameter first, followed by optional types, the option key name, an optional default value for the key and a description of the option.

    # @param [Hash] opts the options to create a message with.
    # @option opts [String] :subject The subject
    # @option opts [String] :from ('nobody') From address
    # @option opts [String] :to Recipient email
    # @option opts [String] :body ('') The email's body 
    def send_email(opts = {})

@overload: Describe that your method can be used in various contexts with various parameters or return types. The first line should declare the new method signature, and the following indented tag data will be a new documentation string with its own tags adding metadata for such an overload.

    # @overload set(key, value)
    #   Sets a value on key
    #   @param [Symbol] key describe key param
    #   @param [Object] value describe value param
    # @overload set(value)
    #   Sets a value on the default key `:foo`
    #   @param [Object] value describe value param
    def set(*args)

@param: Defines method parameters

    @param [optional, types, ...] argname description

@private: Defines an object as private. This exists for classes, modules and constants that do not obey Ruby's visibility rules. For instance, an inner class might be considered "private", though Ruby would make no such distinction. By declaring the @private tag, the class can be hidden from documentation by using the --no-private command-line switch to yardoc (see


@raise: Describes an Exception that a method may throw

    @raise [ExceptionClass] description

@return: Describes return value of method

    @return [optional, types, ...] description

@see: "See Also" references for an object. Accepts URLs or other code objects with an optional description at the end.

    @see Description of URL
    @see SomeOtherClass#method

@since: Lists the version the feature/object was first added

    @since 1.2.4

@todo: Marks a TODO note in the object being documented

    @todo Add support for Jabberwocky service
      There is an open source Jabberwocky library available 
      at that can be integrated easily
      into the project.

@version: Lists the version of a class, module or method

    @version 1.0

@yield: Describes the block. Use types to list the parameter names the block yields.

    # for block {|a, b, c| ... }
    @yield [a, b, c] Description of block

@yieldparam: Defines parameters yielded by a block

    @yieldparam [optional, types, ...] argname description

@yieldreturn: Defines return type of a block

    @yieldreturn [optional, types, ...] description

II. Type Info Descriptions

* class names: ``Whatever'' = an object that is an instance of Whatever
* duck typing: ``#to_s'' = object that responds to the method to_s
* collections: ``Array<String, Symbol>'' = array of strings and symbols
* known constants: ``true'' = the value true

III. Tag References

# @param name (see OtherClass#method)