Snelle referentie

TomDoc Spiekbrief

Beknopte handleiding voor de TomDoc code-documentatiestandaard voor Ruby: methodekoppen, argumentdeclaraties en zichtbaarheidstags.

· Gepubliceerd

TomDoc is een documentatiespecificatie voor het schrijven van duidelijke, door mensen leesbare codecommentaren.

Voorbeeld van een methodekop (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

Zichtbaarheidstags (Visibility Tags)

  • Public: Beschikbaar voor externe bibliotheekgebruikers.
  • Internal: Intern gebruikt binnen modules; geen onderdeel van de publieke API.
  • Deprecated: Gepland voor verwijdering in toekomstige versies.

Argumenten en opties (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- en Return-declaraties

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

Methodesignaturen (Method Signatures)

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

Referenties

Verwante onderwerpen