psych
psych copied to clipboard
Psych.dump escape keys with explicit line_width: 0
According to the documentation line_width parameter has default value 0. But if it passed explicit method has a different behaviour.
> YAML.dump({ "q" => 1 })
=> "---\nq: 1\n"
> YAML.dump({ "q" => 1 }, line_width: 80)
=> "---\nq: 1\n"
> YAML.dump({ "q" => 1 }, line_width: 0)
=> "---\n\"q\": 1\n"
Expected behaviour:
> YAML.dump({ "q" => 1 }, line_width: 0)
=> "---\nq: 1\n"
Environment: ruby 2.6.2 psych 3.1.0