I have an object with a method returning a lambda:
class Book
def mark_page(marker_color)
lambda do |page|
page.mark(marker_color)
end
end
end
And I want to document this Book#mark_page
method using yardoc syntax. However, I cannot find anything about lambdas in this documentation.
Intuitively, I'd go for something like:
# @return [Proc(Page)]
Since yardoc.org/types is parsing it as:
a Proc containing (a Page)
PS: not so sure about the documentation tag. Feel free to remove it if not appropriate...
# @return [Proc]
See rubydoc.info/gems/yard/file/docs/Tags.md#return. Note that you're returning aProc
object, so the P needs to be uppercase, not lowercase. Not sure what you think{Page}
means in this context, but it doesn't belong. – Gybe{Page}
is the whole point of my question. I want to tell that I am returning aProc
which takes aPage
as argument. Quite similar to JSDoc when you return a function and explicit it's arguments. From your given link, I end up thinkingProc(Page)
is the closest solution (yardoc.org/types). But I'm not sure it is semantically correct. – Delphiadelphic