YARD を使用していくつかの Ruby コードを文書化しましたが、トップレベルの名前空間のいくつかのメソッド用に作成した YARD 文書を yardoc の HTML 出力に表示するのに問題があります。
私のドキュメントは、lib/yard/globals.rb にある YARD gem のものと本質的に同じように見えますが、@api
タグが追加されています。私はそれを削除しようとしましたがyardoc
、パラメーターなしで実行しまし--api
たが、問題は解決しませんでした。
これは例です:
#!/usr/bin/ruby
# @group PIP Negotiation: Backend and helper methods
#
# Deserializes a topology graph in YAML format into the database.
#
# @api pip-negotiate
# @param [String] graph A FleRD graph in YAML format
# @return [Boolean] status True if graph was deserialized successfully, False otherwise.
# @return [Integer] gl_id The database ID of the deserialized GraphLabel (nil if deserialization failed).
# @return [Array] output Standard output channel of flerd-deserialize.rb(1)
# @return [Array] output Standard error channel of flerd-deserialize.rb(1)
def insert_graph(graph)
return [ true, 1, ["1"], [""] ] # Not the actual method body.
end
# @endgroup
yardoc
HTML ドキュメントを生成するために実行すると、最初はすべて問題ないように見えます。
% yardoc -o pip-negotiate --api pip-negotiate '**/*.rb'
Files: 1
Modules: 0 ( 0 undocumented)
Classes: 0 ( 0 undocumented)
Constants: 0 ( 0 undocumented)
Methods: 1 ( 0 undocumented)
100.00% documented
%
ただし、生成された HTML には、私のドキュメントは含まれていません。pip-negotiate
含まれているのは、 API タグを持つメソッドのリストだけです。ここで自分の目で確かめてください:
http://btw23.de/tmp/pip-negotiate/api/method_list.html
私が代わりに期待していたのは、トップレベルのメソッドに関する YARD 独自のドキュメントのようなものでした。
http://rubydoc.info/gems/yard/toplevel
私のyardoc
呼び出しに欠けている特別な魔法はありますか?
私の yardoc バージョンは 0.8.6.2 で、Ruby 1.8.7 (2012-06-29 パッチレベル 370) [x86_64-linux] で動作します。