Hi -- On Tue, 27 Feb 2001, Bryan Zarnett wrote: > Is there anyone copying some of Dave's responses into > the cookbook on the Garden (if Dave does not mind). > Everytime he responds I have to go back and change my > code somewhere (thanxs Dave). > > I definitly think things like: > > command = > /#{@pre}\s*(.*?)\s*#{@post}$/s.match(part)[1] > > and > > DEBUG && !yield && raise('assertion failed') > > and > > class Class > def double(single, double) > class_eval %{ > def #{double}(*args) > #{single}(*args) > #{single}(*args) > end > } > end > end A couple o' things: 1. The Dav* who wrote the first example (me) is not the same as the Dav* who wrote the second and third examples (Dave Thomas). 2. I've already posted a supposed improvement to the regex example, because the above raises an exception if the match fails. I don't like my improvement, however, so here's another improvement: command = /#{@pre}\s*(.*?)\s*#{@post}$/s.match(part) && $1 if command... My instinct tells me that there's probably a better/nicer way I'm not thinking of. That instinct is rarely wrong. But I digress. 3. I *think* I prefer the idea of people putting their own stuff in the various cookbooks and gardens. But I'm not sure. I guess if it's here, it might as well be there. (Exactly what "there" means is a slightly vexed issue, but I'll leave that to the side for the moment.) 4. In spite of Dave T.'s remark that one can't make a living from the "Programming Ruby" royalties, I'd be grateful if you could contact both our publishers and get them to send me his check instead of mine :-) David (thinking of changing his name to Mrs. Emma Peel) -- David Alan Black (the media scholar, not the New Testament scholar) (yes, there really is one of each) home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav