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
In Ruby, include is enough add both the class and instance methods because of the self.included block
In RBS however, in order to get this to work, I have to do the following in RBS (note the extend needed in the Post RBS definition that isn't needed in the Post Ruby class):
This isn't a big issue when hand writing all types, but tools like rbs-inline only generate a Post RBS file that look like this, and therefore only includes the instance methods:
classPostincludeSomethingend
It would be nice if there were some way of RBS recognizing class methods defined in a module that is included, e.g.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Consider the following common code to include a bunch of common instance/class methods:
In Ruby, include is enough add both the class and instance methods because of the self.included block
In RBS however, in order to get this to work, I have to do the following in RBS (note the extend needed in the Post RBS definition that isn't needed in the Post Ruby class):
This isn't a big issue when hand writing all types, but tools like rbs-inline only generate a Post RBS file that look like this, and therefore only includes the instance methods:
It would be nice if there were some way of RBS recognizing class methods defined in a module that is included, e.g.
or
Or does something like this already exist, and I'm just unable to see it in any of the RBS docs?
Beta Was this translation helpful? Give feedback.
All reactions