Quoting rob / cs.auckland.ac.nz, on Sat, May 20, 2006 at 09:50:49AM +0900: > In the nil case, I wanted it to iterate and be printed as in the same > way as a non-nil value. In the plot data, a nil prints as '-'. I > hadn't thought of other code expecting to fail when the value was nil > or not an array. They probably wont want nil to have a to_s() > returning '-' either, not that anything has failed doing this, in > this instance. The temptation to change the core classes to work a little more like you want is almost overwhelming... at least I have found it so. I guess in this case you could do: def gnuplot_each(v, &proc) if v.respond_to? :each v.each &proc else yield v end end then instead of doing data.each {..} you could do gnuplot_each(data) {...} cheers, Sam