I am writing my first gem, which I am documenting with YARD. I made one of my classes a constructor that expects a block that takes no arguments 1 .
YARD provides the @yield [params] description tag to describe the block argument in terms of the parameters that the method will pass to it, but it will not be formatted properly if the params list is empty. How should I document a block without parameters?
1 : technically, I am not even yield for a block; I have a code that looks like this:
def initialize(&block) define_singleton_method(:create, block) create class << self; undef_method :create; end end
... therefore the block contains the code to run in the context of the newly created object. If for some reason this is a terrible idea, I would be happy to know this too :)
source share