You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write a custom compiler for a gem that uses a DSL to add methods to Active Record model classes.
The problem is that the DSL simply calls define_singleton_method and does not maintain a list of the methods it defines. So there is no way to know which methods were defined by the gem when introspecting an Active Record model class.
After digging into the Tapioca repo, I saw that the compilers for delegated_type and has_secure_token have the same issue, and the workaround is to override the DSL methods to maintain a list of generated methods internally, using this extension.
I want to do something similar, however it looks like while Tapioca will look for custom compilers in the sorbet/tapioca/compilers directory, there is no equivalent for loading custom extensions. Extensions have to be loaded before the application, and the application is loaded before compilers, so I can't load the extension from the compiler.
Did I miss something, or is this something that is not currently supported? If not, would you be open to a PR to add support for this?
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to write a custom compiler for a gem that uses a DSL to add methods to Active Record model classes.
The problem is that the DSL simply calls
define_singleton_method
and does not maintain a list of the methods it defines. So there is no way to know which methods were defined by the gem when introspecting an Active Record model class.After digging into the Tapioca repo, I saw that the compilers for
delegated_type
andhas_secure_token
have the same issue, and the workaround is to override the DSL methods to maintain a list of generated methods internally, using this extension.I want to do something similar, however it looks like while Tapioca will look for custom compilers in the
sorbet/tapioca/compilers
directory, there is no equivalent for loading custom extensions. Extensions have to be loaded before the application, and the application is loaded before compilers, so I can't load the extension from the compiler.Did I miss something, or is this something that is not currently supported? If not, would you be open to a PR to add support for this?
The text was updated successfully, but these errors were encountered: