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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top