我正在使用Ruby on Rails 3.1.0和YARD 0.7.4 gem来进行文档编制。我想从另一个参数引用参数(@param
tag)。也就是说,我有:
# ...
#
# @param [String] argument_1
# Here I would like to have a description text with a reference/link to the
# 'argument_2' parameter (see below)...
#
# Maybe here I can use something like '@param', '{}' or '@macro'... but, how?
#
# @param [String] argument_2
# Some description text...
#
def method_name(argument_1, argument_2)
...
end
有可能吗?如果是这样,我该如何做到?
答案 0 :(得分:-3)
我对YARD知之甚少,但我用过的文档工具都没有提供这样的能力。我想那是因为这很少,如果真的需要的话。
相反,只需提及参数的名称,从上下文中可以明显看出它是您所指的参数:
# True when number is between given min and max values.
# @param [Number] min
# Must be smaller or equal to max.
# @param [Number] max
# Must be larger or equal to min.
def between?(min, max)
min <= self && self <= max
end