gpt4 book ai didi

ruby - 如何防止 Yard 使用 @return 的内容作为描述?

转载 作者:数据小太阳 更新时间:2023-10-29 07:37:51 25 4
gpt4 key购买 nike

除了指定它输出的内容外,我没有什么有用的东西可以写这个函数。如果 Yard 没有找到描述,它会使用 @return 的内容。有什么办法可以防止这种情况发生吗?我想避免像您在下面的示例中看到的那样愚蠢的重复。

##
# @return [Array<Hash>]
#
# an array of hashes. Example output:
#
# [
# {:name=>"FORNEBU", :municipality=>"BÆRUM", :county=>"AKERSHUS"},
# {:name=>"FORSAND", :municipality=>"FORSAND", :county=>"ROGALAND"}
# ]
#

Screenshot

最佳答案

你可以使用@example标签

##
# @return [Array<Hash>]
# @example
# an array of hashes. Example output:
#
# [
# {:name=>"FORNEBU", :municipality=>"BÆRUM", :county=>"AKERSHUS"},
# {:name=>"FORSAND", :municipality=>"FORSAND", :county=>"ROGALAND"}
# ]
#

输出 yard output

方法描述如下:

#method_name(args) ⇒ Array<Hash>

关于ruby - 如何防止 Yard 使用 @return 的内容作为描述?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23392944/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com