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

Fix #value for a dstr node. #167

Merged
merged 1 commit into from Jan 23, 2021
Merged

Conversation

dvandersluis
Copy link
Member

dstr nodes previously used StrNode, which exposes #value; however, it just returns the first child, which is a node, not a string value.

This changes dstrs to have their own node class that inherits from StrNode but overrides #value as to get the actual string value of the node (including any interpolations).

ie.

'foo' \
'bar'

# previously:
dstr_node.value => s(:str, "foo")

# after change:
dstr_node.value => 'foobar'

@dvandersluis dvandersluis force-pushed the dstr-value branch 2 times, most recently from 55fa88f to bffe9b5 Compare January 23, 2021 19:48
@marcandre
Copy link
Contributor

Seems like a good addition. Would you add a Changelog entry (same way as the main gem) please?

@dvandersluis
Copy link
Member Author

Definitely!

@marcandre
Copy link
Contributor

Still can't see it...

@dvandersluis
Copy link
Member Author

@marcandre updated now!

@marcandre marcandre merged commit 2e19ee8 into rubocop:master Jan 23, 2021
@marcandre
Copy link
Contributor

Thanks!
Released 1.4.1

@tas50
Copy link

tas50 commented Jan 29, 2021

@dvandersluis Thanks for fixing this. I had actually been working around it.

tas50 added a commit to chef/cookstyle that referenced this pull request Jan 29, 2021
This was fixed in rubocop-ast so we don't have to get the source anymore
to get the actual string.

rubocop/rubocop-ast#167

Signed-off-by: Tim Smith <tsmith@chef.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants