← 返回命令列表

Linux command

yard 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate docs

yard doc

Start server

yard server

List undocumented

yard stats --list-undoc

Generate for specific files

yard doc [lib/**/*.rb]

Generate for gems

yard gems

Show documentation for a class or method

yard ri [ClassName]

说明

yard (Yay! A Ruby Documentation Tool) generates API documentation from Ruby source code. It parses specially formatted comments above classes, modules, and methods to produce browsable HTML documentation with cross-references and search. YARD uses its own tag syntax (such as @param, @return, @example) within comments to describe method signatures, return types, and usage examples. It also supports Markdown and other markup formats for free-form documentation within comments. The server subcommand starts a local web server for live documentation browsing during development. The stats subcommand reports documentation coverage, and --list-undoc identifies undocumented code. Templates control the HTML output layout and can be customized or replaced entirely.

参数

doc
Generate docs.
server
Start server.
stats
Show statistics.
gems
Document gems.
ri
Show documentation.
diff
Show changes in documentation.
--list-undoc
List undocumented objects.

FAQ

What is the yard command used for?

yard (Yay! A Ruby Documentation Tool) generates API documentation from Ruby source code. It parses specially formatted comments above classes, modules, and methods to produce browsable HTML documentation with cross-references and search. YARD uses its own tag syntax (such as @param, @return, @example) within comments to describe method signatures, return types, and usage examples. It also supports Markdown and other markup formats for free-form documentation within comments. The server subcommand starts a local web server for live documentation browsing during development. The stats subcommand reports documentation coverage, and --list-undoc identifies undocumented code. Templates control the HTML output layout and can be customized or replaced entirely.

How do I run a basic yard example?

Run `yard doc` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does doc do in yard?

Generate docs.