私はプロジェクトを文書化しており、本質的に次のようなものがあります。
def foo
return bar(__method__)
end
def bar (method)
return method.to_s + 'somestring'
end
私は、fooを実装した方法と同様の多数のメソッドを設定していますが、それらはbarの戻り値を返しています。例は次のとおりです。
# The descriptions for foo0...
# @return [String] the method name concatenated with somestring
def foo0
return bar(__method__)
end
# The descriptions for foo1...
# @return [String] the method name concatenated with somestring
def foo1
return bar(__method__)
end
# The descriptions for bar...
# @return [String] the method name concatenated with somestring
def bar (method)
return method.to_s + 'somestring'
end
bar
しかし、整数に戻るものを変更すると、ドキュメントが正しくなくなります。YARDでDSLを文書化することはよく知っていますが、別のメソッドを記述するときに#bar@return.type
、メソッドのリターンのリターンタイプをどのように指定するのですか。bar
私が言及しているものの例は次のとおりです。
# The descriptions for foo0...
# @return [#bar@return.type] the method name concatenated with somestring
def foo0
return bar(__method__)
end
# The descriptions for foo1...
# @return [#bar@return.type] the method name concatenated with somestring
def foo1
return bar(__method__)
end
# The descriptions for bar...
# @return [String] the method name concatenated with somestring
def bar (method)
return method.to_s + 'somestring'
end
最終的に私が達成しようとしているのは、別のメソッドが定義されているものに依存する戻り型のような絶対値を定義する必要なしに、コードを文書化することです。
更新:呼び出して、リターンまたはメソッドをメソッドと同じよう# @return (see #bar)
にリストすることができることを発見しましたが、返されるタイプを簡単に取得する方法や、リターンの説明をオーバーロードする方法を判断できません。のカスタム説明付き。foo
bar
bar
foo