Skip to content

Pass through all options if present.#753

Merged
byroot merged 1 commit intoruby:masterfrom
ioquatix:json-dump-options
Feb 18, 2025
Merged

Pass through all options if present.#753
byroot merged 1 commit intoruby:masterfrom
ioquatix:json-dump-options

Conversation

@ioquatix
Copy link
Copy Markdown
Member

@ioquatix ioquatix commented Feb 14, 2025

I understand there is a compatibility concern here 8e0076a

However, I'd like to try this out (check CI is passing).

@ioquatix
Copy link
Copy Markdown
Member Author

ioquatix commented Feb 14, 2025

For reference, it's also possible to achieve what I want using JSON::State.generate directly:

OPTIONS = {indent: "  ", space: " ", space_before: "", object_nl: "\n", array_nl: "\n"}

def self.output(file, value)
  ::JSON::State.generate(value, OPTIONS, file)
  file.puts
end

However, I'm not sure if JSON::State is considered stable public interface.

@byroot byroot merged commit b86a47d into ruby:master Feb 18, 2025
33 checks passed
@ioquatix ioquatix deleted the json-dump-options branch February 19, 2025 07:57
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.

2 participants