YAML serialization bug
----------------------

                 Key: JRUBY-2443
                 URL: http://jira.codehaus.org/browse/JRUBY-2443
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1
            Reporter: Karthik Krishnan
         Attachments: yaml_jruby_bug.rb

Extending Objects in the following way fails to serialize in JRuby.  However, 
the same example works fine in MRI.

{code:title=sample.rb|borderStyle=solid}
require 'yaml'
module StringExt
    def self.included(base) #:nodoc:
        base.class_eval do
            attr_accessor :encryptor
        end
    end
end

::String.class_eval do
    include StringExt
end

a = String.new("God is Great")
a.encryptor = "dasdasf"
puts a.encryptor.inspect
serialized_object = a.to_yaml
puts serialized_object
b = YAML::load(serialized_object)
puts (a == b ? "TEST PASSED" : "TEST FAILED")
{code} 

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