Skip to content

Instantly share code, notes, and snippets.

@bcaccinolo
Last active October 11, 2019 09:42
Show Gist options
  • Save bcaccinolo/b8864477c75e2b5ca57ce2e4225ea4df to your computer and use it in GitHub Desktop.
Save bcaccinolo/b8864477c75e2b5ca57ce2e4225ea4df to your computer and use it in GitHub Desktop.
Yardoc template

Links

Documentation examples

You likely won't use all the available tags (words starting with an @) shown in the bellow examples. These examples are more of a cheat sheet of what you can do and where you can use them.

Modules

# Namespace for classes and modules that handle serving documentation over HTTP
# @since 0.6.0

Classes

# Abstract base class for CLI utilities. Provides some helper methods for
# the option parser
#
# @abstract Subclass and override {#run} to implement
# @since 0.6.0
#
# @!attribute [rw] attribute_name
#   @return [Types] a full description of the attribute
#
# @!attribute [r] name
#  @return [Types] description of a readonly attribute
#
# @!attribute [r] name
#   @return [Types] description of writeonly attribute
#
# @deprecated Describe the reason or provide alt. references here

# @!group Callbacks

  # Following methods will be placed into a group with the given
  # description as the group name
  def before_filter; end
  def after_filter; end

# @!endgroup

Methods

# An alias to {Parser::SourceParser}'s parsing method
#
# @see http://example.com Description of URL
# @see SomeOtherClass#method
#
# @deprecated Use {#my_new_method} instead of this method because
#   it uses a library that is no longer supported in Ruby 1.9.
#   The new method accepts the same parameters.
#
# @param opts [Hash] 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
#
# @param opts [OptionParser] the option parser object
# @param args [Array<String>] the arguments passed from input. This
#   array will be modified.
# @param list [Array<String, Symbol>] the list of strings and symbols.
#
# The options parsed out of the commandline.
# Default options are:
#   :format => :dot
#
# @example Reverse a string
#   "mystring.reverse" #=> "gnirtsym"
#
# @example Parse a glob of files
#   YARD.parse('lib/**/*.rb')
#
# @raise [ExceptionClass] description
#
# @note This method should be use with care because…
#
# @return [optional, types, ...] description
# @return [true] always returns true
# @return [void] # return type is meaningless
# @return [String, nil] the contents of our object or nil
#   if the object has not been filled with data.
#
# @return [String, #read] a string or object that responds to #read

Blocks

# for block {|a, b, c| ... }
# @yield [a, b, c] Yield 3 random numbers to the block
#
# @yieldparam argname [Types] description
# @yieldreturn [Types] description

Anywhere

# @todo Add support for oauth
#   There is a description of why and what you want to do
#   later with this feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment