Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #69
I created a new method based on
parse_sig_into_methods
calledparse_method_into_methods
. This new method will generateRbiGenerator::Method
s andRbiGenerator::Attribute
s from unsigged methods, setting any parameter types and return types toT.untyped
.I had started by trying to adapt the
parse_sig_into_methods
to handle thesig
not being present but there were a lot of validations sprinkled throughout the method and adding a bunch of conditionals made it much harder to read. One idea on how to remove some of the duplication:parse_method_into_methods
as-is, basically take a method call orattr_*
and return a method/attribute that is totally untyped.parse_sig_into_methods
parse_method_into_methods
to generate untyped methods/attributesI'd lean toward leaving this PR as-is (i.e. with the duplication) and applying this or some other type of refactor as a follow up if you wanted to. There would probably be some personal preference involved in how you actually DRYed up the code so might make more sense as something you'd do vs a contributor.