From: Adam Shelly Date: 2005-09-01T08:08:08+09:00 Subject: Re: beginners YAML question ------=_Part_1949_2693219.1125529685567 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks, That fixed the load error, but there is still a problem with the to_yaml=20 routine. The additional @size parameter never gets written to the YAML=20 string. require 'Yaml' class Box< Array def initialize size @size =3D size end def size @size end end box =3D Box.new(2) print "ERROR: Box, #{box.size}!=3D2" unless box.size =3D=3D 2 box2 =3D YAML::load(box.to_yaml) print "ERROR: Box2, #{box2.size}!=3D2" unless box2.size =3D=3D 2 p box.to_yaml ERROR: Box2, !=3D2=20 --- !ruby/array:Box []=20 Any ideas?=20 -Adam On 8/30/05, daz wrote: >=20 >=20 > Adam Shelly wrote: >=20 > > [...] It was working fine until I tried to reload it > > from YAML. Here is some code that reproduces the problem. >=20 > Thanks - makes it much easier :-) >=20 > > - Why doesn't it work? >=20 > A bug which seems to be fixed in a later version. >=20 > > - How can I make it work? >=20 > Edit this file: > C:\ruby\lib\ruby\1.8\yaml\rubytypes.rb >=20 > Find two occurrences (lines 80 & 239) of: >=20 > o =3D obj_class.new >=20 > .... and replace both with: >=20 > o =3D obj_class.allocate >=20 > > Thanks, > > -Adam >=20 > No probs, >=20 > daz >=20 >=20 >=20 >=20 > ------=_Part_1949_2693219.1125529685567--