-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Document named captures #320
Document named captures #320
Conversation
Something to point out is that you can do this without actually making them captures, ie
will also work to ensure the same value in both spots, without capturing Also (as discussed on the discord), this also works: |
Oh, interesting. It's probably better to move it to https://docs.rubocop.org/rubocop-ast/node_pattern.html#_-for-any-single-node then. If the |
fc03d02
to
9dfbf8c
Compare
9dfbf8c
to
84af31f
Compare
84af31f
to
3f4db4c
Compare
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.
Looks really good to me! Thanks @Earlopain
Correct. Thanks for the PR 🚀
That's incorrect. The lexer is often not space sensitive. In this case, Would it be helpful to support named "rest"? I think it should look like |
Note: I'm not too sure how to force the update of the docs, but I'm planning on resolving #319 soonish and will release that. |
Got it, that makes sense. I was pointing it out as an observation I had when playing with the pattern tester, but I didn't look into it closer. Thanks for the explanation. I think it'd make sense in the abstract to support |
Ok cool. Maybe we could mention in the docs that it's not supported but to open an issue if there's ever an actual use case? |
It's a nifty feature currently not mentioned in the docs. Hash keys can be interpolated which would then not make this match anymore but for demonstration purposes this is the best example I could come up with.
cc @dvandersluis
Unrelated to this, I've added ruby code styling to a code block that was previously missing it.