ruby / ruby/psych

Psych.dump escape keys with explicit line_width: 0

Open
#422 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
597
Forks
223
Avg merge
11h 23m
Merged PRs (30d)
3

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Psych.dump/YAML.dump handling of the explicit line_width: 0 argument and compare it with the omitted or default parameter behavior described in the issue. Reproduce the Ruby 2.6.2 and Psych 3.1.0 examples, then verify that an explicit zero produces the same output as the default without changing other line-width behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.