クイックリファレンス

TomDoc チートシート

Ruby向けのTomDocコードドキュメント仕様のクイックリファレンス。メソッドヘッダー、引数宣言、可視性タグを網羅。

· 公開日

TomDoc は、明確で人間が読みやすいコードコメントを書くためのドキュメント仕様です。

メソッドヘッダーの例 (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

可視性タグ (Visibility Tags)

  • Public: 外部のライブラリ利用者が使用可能。
  • Internal: ライブラリモジュール内部で使用され、公開APIの一部ではない。
  • Deprecated: 将来のバージョンで削除予定。

引数とオプション (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).

Yield と Return 構文

# 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)

参考リンク

関連テーマ