Yard

Enjoy this cheat sheet at its fullest within Dash, the macOS documentation browser.

Templates

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
#
# @author Full Name
# @abstract
# @since 0.6.0
# @attr [Types] attribute_name a full description of the attribute
# @attr_reader [Types] name description of a readonly attribute
# @attr_writer [Types] name description of writeonly attribute
# @deprecated Describe the reason or provide alt. references here

methods

# An alias to {Parser::SourceParser}'s parsing method
#
# @author Donovan Bray
#
# @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.
#
# @abstract
# @private
#
# @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
#
# @param (see User#initialize)
# @param [OptionParser] opts the option parser object
# @param [Array<String>] args the arguments passed from input. This
#   array will be modified.
# @param [Array<String, Symbol>] list 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
#
# @return [optional, types, ...] description
# @return [true] always returns true
# @return [void]
# @return [String, nil] the contents of our object or nil
#   if the object has not been filled with data.
#
# We don't care about the "type" here:
# @return the object
#
# @return [String, #read] a string or object that responds to #read
# @return description here with no types

anywhere

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

blocks

# for block {|a, b, c| ... }
# @yield [a, b, c] Description of block
#
# @yieldparam [optional, types, ...] argname description
# @yieldreturn [optional, types, ...] description

Tags

@abstract

# @abstract Subclass and override {#run} to implement
#   a custom Threadable class.
class Runnable
  def run; raise NotImplementedError end
end

@api

class Post
  # @api private
  def reset_table!; table.flush end
end

@author

# @author Foo Bar <foo@bar.com>
class MyClass; end

@deprecated

# @deprecated Use {#bar} instead.
def foo; end

class Thread
  # @deprecated Exiting a thread in this way is not reliable and
  #   can cause a program crash.
  def kill; end
end

@example

# @example Reverse a String
#   "mystring".reverse #=> "gnirtsym"
def reverse; end

@note

# @note This method should only be used in outer space.
def eject; end

@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 = {}) end

@overload

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

@param

# @param url [String] the URL of the page to download
# @param directory [String] the name of the directory to save to
def load_page(url, directory: 'pages') end

@private

# @private
class InteralImplementation; end

@raise

# @raise [AccountBalanceError] if the account does not have
#   sufficient funds to perform the transaction
def withdraw(amount) end

@return

# @return [Fixnum] the size of the file
def size; @file.size end

# @return [String] if a single object was returned
#   from the database.
# @return [Array<String>] if multiple objects were
#   returned.
def find(query) end

@see

# Synchronizes system time using NTP.
# @see http://ntp.org/documentation.html NTP Documentation
# @see NTPHelperMethods
class NTPUpdater; end

@since

# @since 1.2.4
def clear_routes; end

@todo

# @todo Add support for Jabberwocky service.
#   There is an open source Jabberwocky library available
#   at http://jbrwcky.org that can be easily integrated.
class Wonderlander; end

@version

# The public REST API for http://jbrwcky.org
# @version 2.0
class JabberwockyAPI; end

@yield

# For a block {|a,b,c| ... }
# @yield [a, b, c] Gives 3 random numbers to the block
def provide3values(&block) yield(42, 42, 42) end

@yieldparam

# @yieldparam [String] name the name that is yielded
def with_name(name) yield(name) end

@yieldreturn

# @yieldreturn [Fixnum] the number to add 5 to.
def add5_block(&block) 5 + yield end

Notes