How to use Yard to document enumerable type and the types that they contain?
-
08-01-2021 - |
Вопрос
Using the ruby Yard doc tool I can write
# @param bar [String]
def foo(bar)
end
however if the parameter is an enumerable
# @param bar [Enumerable[String]]
def foo(bar)
end
Is the above the correct way or not?
Решение
Do it like this:
# @param [Enumerable<String>] bar
def foo(bar)
end
Reference: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md#Declaring_Types
Не связан с StackOverflow