From: Simon Vandemoortele Date: 2003-04-27T22:33:43+09:00 Subject: How to undefine a member variable ? (or at least hide it from YAML) I came across the following problem while using YAML: #+v require "yaml" class A attr_writer :s end a = A.new puts (a.s ="something").to_yaml => "--- !ruby/object:A \na: something" puts (a.s = nil).to_yaml "--- !ruby/object:A \na: #-v My problem, as you can see, is that: 1) once I've assigned to a member variable there is (to my knowledge) no way to 'undefine' it 2) YAML dumps all defined variables This means that, over time, my object dumps will become more and more cluttered with empty entries. I am sure YAML experts have run into that problem and have a lot to say about it ... As I see it: either I find a way to 'undefine' a variable, or I find a way to tell YAML *not* to dump nil values. (I prefer the latter of course.) Simon -- There are 10 types of people in the world... those who understand binary and those who don't.