Feature #6840
closedYAML tag method
Description
=begin
When loading YAML documents that have a tag, there doesn't seem to be anyway to query for that information.
h = YAML.load("--- !foo\na: 1\nb: 2")
h #=> {"a"=>1, "b"=>2}
h.what_method? #=> "!foo"
I know about YAML.add_domian_tag
and the like, but registering tags up front doesn't always fit the usecase. For instance, I am working on a project where I don't want the end users to have to use a support library to work with the data, and I certainly don't expect them to copy and paste dozens of lines of #add_domain_tag boilerplate to their projects. Yet the tags can be useful to them for type revison information, e.g.
--- !foo/2
So this is the second revision of the foo type. The information could be important to consumer apps to ensure they handle the data properly.
So I am proposing that Pysch add a method (maybe call it #yaml_tag
), that can be used to get this information from an object when it has been loaded via YAML.
=end
Files