加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-17 02:06:25 所属栏目:百科 来源:网络整理
导读:除了指定它输出的内容之外,我没有什么有用的东西来写这个函数.如果Yard没有找到描述,则使用@return的内容.有什么方法可以阻止这种情况吗?我想避免愚蠢的重复,就像你在下面的例子中看到的那样. ### @return [ArrayHash]## an array of hashes. Example outpu
除了指定它输出的内容之外,我没有什么有用的东西来写这个函数.如果Yard没有找到描述,则使用@return的内容.有什么方法可以阻止这种情况吗?我想避免愚蠢的重复,就像你在下面的例子中看到的那样.

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

解决方法

你可以使用@example标签

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

输出

yard output

方法描述如下:

#method_name(args) ? Array<Hash>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读