`ruby/object:*` tag not used for scalar value
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 597
- Forks
- 223
- Avg merge
- 11h 23m
- Merged PRs (30d)
- 3
Description
class Custom
def initialize
@value = 1
end
def encode_with(coder)
coder.scalar = @value.to_s
end
def init_with(coder)
@value = coder.scalar.to_i
end
end
YAML::load(YAML::dump(Custom.new)) # => 1
Would expect that to return a Custom since dump emits the correct tag, bug instead get 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Ruby reproduction using Custom#encode_with, Custom#init_with, YAML::dump, and YAML::load. Trace how Psych handles the emitted ruby/object:* tag when the serialized value is scalar. Done means loading the dumped object returns a Custom instance with its value restored as 1.
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
- Clearly specified
- Newbie friendliness
- 45/100