-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fix conflict between Hash#values_at
and "Parallel Assignment"
#936
Conversation
Hash#values_at
and "Parallel Assignment"Hash#values_at
and "Parallel Assignment"
README.adoc
Outdated
@@ -2297,7 +2297,7 @@ Prefer the use of exceptions from the standard library over introducing new exce | |||
=== Parallel Assignment [[parallel-assignment]] | |||
|
|||
Avoid the use of parallel assignment for defining variables. | |||
Parallel assignment is allowed when it is the return of a method call, used with the splat operator, or when used to swap variable assignment. | |||
Parallel assignment is allowed when it is the return of a method call, used with the splat operator, or when used to swap variable assignment, or `Hash#values_at` and `Hash#fetch_values`. |
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.
These built-in methods are very convenient. However, there are many such methods, so it is difficult to come to a common solution without marking them as "bad".
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.
Those are method calls, so it's already covered in this sentence.
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.
Maybe the language could to be tweaked to something like "return of a method call (e.g. Hash#values_at
)..." so this is clearer.
README.adoc
Outdated
@@ -4404,18 +4404,25 @@ batman.fetch(:powers, obtain_batman_powers) # obtain_batman_powers is an expensi | |||
batman.fetch(:powers) { obtain_batman_powers } | |||
---- | |||
|
|||
=== `Hash#values_at` [[hash-values-at]] | |||
=== `Hash#values_at` [[hash-values-at-and-fetch-values]] |
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.
You should check if something in RuboCop doesn't refer to this anchor before changing it.
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.
Sure, there are no links to this anchor.
f532471
to
590d468
Compare
590d468
to
8000356
Compare
No description provided.