YAML messes up custom tag
-------------------------

                 Key: JRUBY-2976
                 URL: http://jira.codehaus.org/browse/JRUBY-2976
             Project: JRuby
          Issue Type: Bug
          Components: Miscellaneous
    Affects Versions: JRuby 1.1.4
            Reporter: Michael S. Allman


Consider the following jirb transcript:

irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> class Person
irb(main):003:1> yaml_as 'tag:data.allman.ms,2008:Person'
irb(main):004:1> end
=> Person
irb(main):005:0> p = Person.new
=> #<Person:0x55bfaf>
irb(main):006:0> p.to_yaml
=> "--- !data/Person {}\n\n"
irb(main):007:0>

When Person p is serialized, the yaml tag is shortened to !data/Person.  This 
is not correct.  Consider the identical script run with plain irb (not JRuby):

>> require 'yaml'
=> true
>> class Person
>> yaml_as 'tag:data.allman.ms,2008:Person'
>> end
=> Person
>> p = Person.new
=> #<Person:0x5bc818>
>> p.to_yaml
=> "--- !data.allman.ms,2008/Person {}\n\n"

Here the tag is written as !data.allman.ms,2008/Person, which I believe is 
correct.

Because JRuby messes up the custom tag, it can't deserialize the YAML with the 
correct type.

I will work on a patch to fix this issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to