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 dumping when there are #$ in array elements. #136

Merged
merged 2 commits into from
Jan 27, 2022

Conversation

shanyungyang
Copy link

There is special treatments to #$ when dumping string values, but this does not work properly for arrays.

require 'toml-rb'
puts TomlRB.dump(value: '#$')   # value = "#$"
puts TomlRB.dump(array: ['#$']) # array = ["\#$"]

This PR fixes array dumping by passing array elements to the to_toml method instead of calling inspect.

@emancu
Copy link
Owner

emancu commented Jan 26, 2022

@shanyungyang thank you for your contribution!

Would you mind fixing the linter, and as an extra favour, fixing the style-inconsistency that I left in the elsif clauses?
Basically, use parenthesis after the is_a? with all the options 🙏 .

elsif obj.is_a? Array -> elsif obj.is_a?(Array)

@shanyungyang
Copy link
Author

@shanyungyang thank you for your contribution!

Would you mind fixing the linter, and as an extra favour, fixing the style-inconsistency that I left in the elsif clauses? Basically, use parenthesis after the is_a? with all the options pray .

No problem.

@emancu emancu merged commit c4f141e into emancu:master Jan 27, 2022
@emancu
Copy link
Owner

emancu commented Jan 27, 2022

@shanyungyang Done, released on v2.1.2

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

2 participants