Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to IO source in type definition #16

Open
trans opened this issue May 29, 2011 · 1 comment
Open

Access to IO source in type definition #16

trans opened this issue May 29, 2011 · 1 comment

Comments

@trans
Copy link

trans commented May 29, 2011

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'))
@tenderlove
Copy link
Member

@trans I can't think of a way off the top of my head. Let me poke around the code and see what I can find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants