+
Skip to content

Conversation

pinecat
Copy link

@pinecat pinecat commented Feb 13, 2022

For a given hash, preserve its structure when generating the TOML doc
string (via TOML::Generator.new(hash).body). To do this, you would pass
in a boolean with the constructor for TOML::Generator.

body = Generator.new(doc, false).body # Creates a TOML string that sorts the hash keys of 'doc'
body = Generator.new(doc, true).body # Creates a TOML string which preserves the structure of the the hash, 'doc'

The default value is false, mimicking the current behavior.

body = Generator.new(doc).body # Creates a TOML string that sorts the hash keys of 'doc'

Fixes #69.

For a given hash, preserve its structure when generating the TOML doc
string (via TOML::Generator.new(hash).body).  To do this, you would pass
in a boolean with the contstructor for TOML::Generator:

body = Generator.new(hash, true).body

The default value is false, mimicking the current behavior.
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.

Feature: Preserve hash strructure when generating a TOML file

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载