-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add an easier syntax to create methods and signatures #284
Conversation
Signed-off-by: Alexandre Terrasa <[email protected]>
@@ -534,6 +534,79 @@ def <<(param) | |||
@params << param | |||
end | |||
|
|||
sig { params(name: String).void } | |||
def add_param(name) |
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.
Since these are all in the form add_...
, perhaps it could be shortened to param
, opt_param
etc? No big deal though.
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.
The issue is with add_sig
, defining a method named sig
in a Sorbet project is creating all kind of trouble. So I went with add_
prefix everywhere
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.
🙏
Creating a new method with a signature can be a bit verbose when manipulating the
RBI
classes directly:This PR introduces a more elegant syntax: