ruby / ruby/psych

Coord y is being rendered as 'y' but x is still x

Open
#558 1 comment 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

I have a rails model with coords, and when dumped to yml the y is rendered incorrectly.

For example,

>> puts Coord.new(x: 13, y: 12).attributes.to_yaml
---
id:
x: 13
"y": 12

instead of the expected

>> puts Coord.new(x: 13, y: 12).attributes.to_yaml
---
id:
x: 13
y: 12

This comes about because of this change ...
https://github.com/ruby/psych/commit/6a1c30634e61967f3d8133b3181b9f301ff7f550

I have commented out those lines and I get the expected coord rendered.
I'm not sure what the solution is because I know that change was added to appease yes/no boolean guff but unfortunately y is a known coordinate also 🤷

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

Reproduce the behavior with Coord.new(x: 13, y: 12).attributes.to_yaml and compare the quoted y output with the expected YAML. Read the referenced Psych commit 6a1c30634e61967f3d8133b3181b9f301ff7f550 to understand the boolean-handling change; done means coordinate keys such as y serialize correctly without regressing yes/no handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, yaml
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.