Project

General

Profile

Feature #6840

YAML tag method

Added by trans (Thomas Sawyer) about 8 years ago. Updated about 8 years ago.

Status:
Rejected
Priority:
Normal
Target version:
[ruby-core:47029]

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

noname (500 Bytes) noname Anonymous, 08/08/2012 06:23 AM
noname (500 Bytes) noname Anonymous, 08/09/2012 03:23 AM

Also available in: Atom PDF