From: Tilman Sauerbeck Date: 2005-01-13T07:01:28+09:00 Subject: Style question - how to represent properties Hi, I'm sorry, but I couldn't think of a more concise subject line. I'm currently writing Ruby bindings for libeet, which serializes C structs to disk. Objects that should be serializable with EET implement the "to_eet_properties" method, which currently looks like this: def to_eet_properties { "name" => [@name], "foobar" => [@some_fixnum, :int] } end So, to_eet_properties must return some kind of enumerable object, and each entry has at least two attributes, a tag and value. Optionally, there's a third attribute. If it's omitted, some default value will be used instead. I'd like to improve the way the user enters these properties. The hash-of-arrays I use currently doesn't feel like the right way to do this, is there a better way? I thought about having the hash accept a single value as a value, too: {"name" => @name} but I don't know whether it's a good idea to have it use an array in some situations and a single value in another. Any recommendations? TIA -- Regards, Tilman