Ulysse BN
Ulysse BN

Reputation: 11403

Document a method returning a lambda

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...

Upvotes: 6

Views: 577

Answers (0)

Related Questions