Skip to content
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

Replace single dig to [] access #7949

Closed
wbotelhos opened this issue May 10, 2020 · 5 comments
Closed

Replace single dig to [] access #7949

wbotelhos opened this issue May 10, 2020 · 5 comments

Comments

@wbotelhos
Copy link

@wbotelhos wbotelhos commented May 10, 2020

Is your feature request related to a problem? Please describe.

When you refactor you code from:

{ key: { subkey: 'value' } }.dig(:key, :subkey)

to:

{ key: 'value' }.dig(:key)

You can forget to use just [] to access the value.

Describe the solution you'd like

Replace single dig methods to [] access.

From:

{ key: 'value' }.dig(:key)

to:

{ key: 'value' }[:key]
@volfgox
Copy link
Contributor

@volfgox volfgox commented May 13, 2020

I'd like to try to implement this feature.

volfgox added a commit to volfgox/rubocop that referenced this issue May 16, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 19, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 19, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 19, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 19, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 22, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 26, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 26, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue May 26, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue Jun 5, 2020
@fatkodima
Copy link
Contributor

@fatkodima fatkodima commented Jul 25, 2020

@volfgox I have seen you did some work on this. Mind opening a PR?

volfgox added a commit to volfgox/rubocop that referenced this issue Jul 26, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue Jul 26, 2020
@volfgox
Copy link
Contributor

@volfgox volfgox commented Jul 26, 2020

@fatkodima I finalized the development and sent a PR and waited long long time to merge. But, It's never been merged. You can review the PR here.

P.S. @bbatsov Would you please consider the PR?

volfgox added a commit to volfgox/rubocop that referenced this issue Jul 28, 2020
volfgox added a commit to volfgox/rubocop that referenced this issue Jul 28, 2020
@marcandre marcandre closed this in a06d146 Jul 28, 2020
@wbotelhos
Copy link
Author

@wbotelhos wbotelhos commented Jul 28, 2020

Thank you, @volfgox !

@volfgox
Copy link
Contributor

@volfgox volfgox commented Jul 28, 2020

@wbotelhos Thank you too. I hope I can contribute more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.