psych icon indicating copy to clipboard operation
psych copied to clipboard

Psych.dump escape keys with explicit line_width: 0

Open hbda opened this issue 6 years ago • 0 comments

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

hbda avatar Oct 30 '19 18:10 hbda