Would anyone besides me appreciate a YAML.dump method, analogous with
Marshal.dump, which takes two args, an object and a File?
Besides bringing the interface into line with Marshal, this would avoid
generating an intermediate string, as in
f.write(object.to_yaml)
I’m just thinking about GC frequency, not functionality…
Note that you can already do
object = YAML.load(f)
(I’m not sure whether it generates an intermediate string.) So having
dump as well would be kinda natural.
While we’re comparing Marshal and YAML, does anyone know if there are
any object types that one handles but the other doesn’t? Are they
equivalent, as far as what they can serialize?
I’ve been very impressed at how well YAML treats Ruby data, but maybe
there’s a gotcha somewhere…