YARD 文件中如何将@return 类型的方法表示为returns 固定大小的数组?
YARD how to document @return type for a method that returns fixed-size array?
我有以下方法:
def foo
[true_or_false, some_integer]
end
它总是 returns 一个包含 2 个元素的数组,其中第一个元素是布尔值,第二个元素是整数。
如何使用 @return
元标记在 YARD 中对其进行记录?
后来是这样用的:
is_success, exit_code = foo
我检查了official documentation on @return section,但没有太大帮助。
# @return [Array(Boolean, Number)] fixed-size array(vector) of a boolean followed by a number
def foo
[true_or_false, some_integer]
end
不要将其与其他类似的 @return
标签格式混淆:
# @return [Array<String, Symbol, #read>] an Array of (Strings, Symbols, objects that respond to #read)
用于 variable-length 不同数据类型的数组,不适用于 fixed-lenght 向量。
我有以下方法:
def foo
[true_or_false, some_integer]
end
它总是 returns 一个包含 2 个元素的数组,其中第一个元素是布尔值,第二个元素是整数。
如何使用 @return
元标记在 YARD 中对其进行记录?
后来是这样用的:
is_success, exit_code = foo
我检查了official documentation on @return section,但没有太大帮助。
# @return [Array(Boolean, Number)] fixed-size array(vector) of a boolean followed by a number
def foo
[true_or_false, some_integer]
end
不要将其与其他类似的 @return
标签格式混淆:
# @return [Array<String, Symbol, #read>] an Array of (Strings, Symbols, objects that respond to #read)
用于 variable-length 不同数据类型的数组,不适用于 fixed-lenght 向量。