-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prototype rb: Extract instance variables and class variables #1343
Conversation
This patch generates the definition of instance variables and class variables just after the method definition:
It seems fine. But in another case, it's a bit strange for me if variables are defined inside a private method.
Is this acceptable? Or, do we need to reorder the definition before generation? Thanks, |
Note: After this post, I and @soutaro talked about this topic in the ruby-jp slack. And we determined to move these variable definitions to the top of the class. So I'll update this PR this weekend. |
To generate natural .rbs files, this moves instance and class variable definitions to the top of the class definition.
I just update my PR to sort the member of class definitions. Now instance variables and class variables will be generated at the top of each class. |
Would you be able to support class instance variables? class C
def self.foo
@foo = 42
end
class << self
def bar
@bar = 42
end
end
@baz = 42
end In this case, |
Thank you for reviewing. Good point! I tried to convert instance variables into class variables. Could you check this again? |
It seems CI for the nightly image failed because installing the stringio gem failed. |
Co-authored-by: Masataka Pocke Kuwabara <[email protected]>
Updated. But, after the update, I don't have a way to promote class instance variables placed just inside the class definition:
Before the update, I used the context not having a namespace... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I understand. I'll try fixing this problem on another PR. |
No description provided.