From: Eric Hodel Date: 2003-09-23T12:10:59-07:00 Subject: Re: Creating classes with from YAML? --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable David Garamond (lists@zara.6.isreserved.com) wrote: > Remembering that all classes are instances of the Class class, is this=20 > possible? I want to create some class named, say C1, which is empty (or= =20 > perhaps with one or two class instance vars) by loading a YAML document.= =20 > I can't seem to create instances of Class class in YAML, while I can=20 > easily do this in irb: irb(main):002:0> 5.to_yaml =3D> "--- 5" irb(main):003:0> Class.to_yaml ArgumentError: can't dump anonymous class Class from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:8:in `to_yaml' from (irb):3 irb(main):004:0> class Foo; end =3D> nil irb(main):005:0> Foo.to_yaml ArgumentError: can't dump anonymous class Class from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:8:in `to_yaml' from (irb):5 Does not appear possible to do with Yaml, but you can with Marshal: irb(main):007:0> Marshal.dump(Foo) =3D> "\004\010c\010Foo" --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/cJrDMypVHHlsnwQRAkvJAJ9N6nrkRwQF1ezrs7ZDliS7YBHt9gCgzVLx DWyJ7VxG/eqRXHg/yvhmMhM= =swIg -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--