Reputation: 16226
I'm investigating what it might take to add Sorbet RBI files to gems that I maintain, and I'm trying to figure out the proper process for this. I don't want to have Sorbet as a runtime dependency for the gems, though, so that means having all the type information in a separate RBI file.
My current queries around this are:
rbi
file at, say, ./sorbet/rbi/gemname.rbi
? And is that where Sorbet will look by default if I package that into the published gem file?./sorbet/rbi/sorbet-typed
and ./sorbet/rbi/hidden-definitions
) in the published gem file?typed
pragma comment in my gem's files, even though the type information is separated into an RBI file? If so, should it reflect the type information that's present in the file the comment is in, or should it reflect the type information available via the RBI file?Upvotes: 3
Views: 977
Reputation: 46
My understanding (I'm in a similar boat) based reading through the custom RBI content is that they recommend writing the definitions in a rbi
directory in the gem root directory. I don't think they should go in the the sorbet
directory since that file gets quite large (and you don't want to have gem users having to download MBs of repeated definitions).
I've been putting the typed
sigils in the library files that I have definitions for and having the RBI files separate. The srb tc
picks up the definitions (and complains as appropriate). This means that I don't need to add sorbet as a gem dependency (other than for development).
Upvotes: 3