Kurzreferenz

TomDoc Spickzettel

Kurzreferenz für den TomDoc-Code-Dokumentationsstandard in Ruby mit Methodenkopf-Beispielen, Argumentdeklarationen und Tags.

· Veröffentlicht

TomDoc ist eine Dokumentationsspezifikation zum Schreiben klarer, menschenlesbarer Code-Kommentare.

Beispiel für einen Methodenkopf (Method Header)

# Public: Duplicate some text an arbitrary number of times.
#
# text  - The String to be duplicated.
# count - The Integer number of times to duplicate the text.
#
# Examples
#
#   multiplex('Tom', 4)
#   # => 'TomTomTomTom'
#
# Returns the duplicated String.
def multiplex(text, count)
  text * count
end

Sichtbarkeits-Tags (Visibility Tags)

  • Public: Für externe Benutzer der Bibliothek verfügbar.
  • Internal: Intern in Bibliotheksmodulen verwendet; kein Teil der öffentlichen API.
  • Deprecated: Zur Entfernung in zukünftigen Versionen vorgesehen.

Argumente und Optionen (Arguments and Options)

# options - The Hash options used to refine selection (default: {}):
#           :color  - The String color to restrict by (optional).
#           :weight - The Float weight in grams (optional).

Yields- und Return-Anweisungen

# Yields the Integer index of the current iteration.
#
# Returns the duplicated String.
# Returns nothing.
# Raises Errno::ENOENT if the file cannot be located.

Methodensignaturen (Method Signatures)

# Signature
#
#   find_by_<field>[_and_<field>...](args)

Referenzen

Verwandte Themen