Run the following snippit and see that JRuby reconstitutes the objects with the same object ID:
require 'yaml'
class YamlTest
def initialize()
@test = Hash.new
@test["hello"] = "foo"
end
end
list = Array.new
list << YamlTest.new
list << YamlTest.new
list << YamlTest.new
list.each do |x|
p x.object_id
end
ylist = YAML.dump(list)
yamlstr = YAML.load(ylist)
yamlstr.each do |x|
p x.object_id
end
In MRI, they come back with different IDs.
Description
Run the following snippit and see that JRuby reconstitutes the objects with the same object ID:
require 'yaml'
class YamlTest
def initialize()
@test = Hash.new
@test["hello"] = "foo"
end
end
list = Array.new
list << YamlTest.new
list << YamlTest.new
list << YamlTest.new
list.each do |x|
p x.object_id
end
ylist = YAML.dump(list)
yamlstr = YAML.load(ylist)
yamlstr.each do |x|
p x.object_id
end