psych icon indicating copy to clipboard operation
psych copied to clipboard

Access to IO source in type definition

Open trans opened this issue 14 years ago • 1 comments

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'))

trans avatar May 29 '11 13:05 trans

@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.

tenderlove avatar Jun 09 '11 02:06 tenderlove