Quick reference

TomDoc Cheatsheet

Quick reference guide for TomDoc code documentation standard for Ruby, covering method headers, argument declarations, and tags.

· Published

TomDoc is a documentation specification for writing clear, human-readable code comments.

Method Header Example

# 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

Visibility Tags

  • Public: Available for consumption by external library users.
  • Internal: Used internally across library modules; not part of public API.
  • Deprecated: Scheduled for removal in future versions.

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 and Return Statements

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

Method Signatures

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

References

Related topics