I'm writing my first gem which I'm documenting with YARD. I've made one of my classes have a constructor which expects a block which takes no arguments1.
YARD provides the @yield [params] description
tag to describe a block argument in terms of the parameters a method will pass to it, but it doesn't format properly if the params
list is empty. How should I document a block with no parameters?
1: Technically, I'm not even yield
ing to the block; I have code that looks like this:
def initialize(&block)
define_singleton_method(:create, block)
create
class << self; undef_method :create; end
end
...so the block contains code to be run in the context of the newly-created object. If this is a terrible idea for some reason, I'd be glad to know that, too :)