AaronC81 / sord

Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files
https://sord.aaronc.cc
MIT License
293 stars 18 forks source link

Optional and required blocks #129

Open AaronC81 opened 3 years ago

AaronC81 commented 3 years ago

Currently, the behaviour of blocks is a bit strange:

This inconsistency isn't intuitive and could lead to some confusion, especially when targeting multiple output types. I think required should be the default across both output types, and that you should be able to change it to optional if you want.

I don't believe YARD has a way of specifying if a block is optional or required, so we'd have to hijack an existing tag somehow, like using the word "Optional" at the beginning of @yield to indicate that it's optional for that method.

wagenet commented 2 years ago

I think you're correct about YARD not being able to specify optional blocks. That does make this a bit annoying to resolve.