Access to IO source in type definition
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 597
- Forks
- 223
- Avg merge
- 11h 23m
- Merged PRs (30d)
- 3
Description
Anyway to access information about the source of YAML when defining a type? I have a case where I want to know if the source was a file and what the file path is.
YAML::add_domain_type("foo.com,2011", "foo") do |type, value|
from_file = ? # 'foo.yaml'
Foo.new(value, :file=>from_file)
end
YAML.load(File.new('foo.yaml'))
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 with the YAML::add_domain_type callback and YAML.load(File.new(...)) example shown in the issue. Investigate how source metadata is passed through loading and whether the callback can receive a file path. Done means a type definition can reliably distinguish file-backed YAML and access its path, with the behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100