From: Alexandru Popescu Date: 2005-08-25T02:48:26+09:00 Subject: Re: ruby way for piece of code #: Jim Menard changed the world a bit at a time by saying on 8/24/2005 7:41 PM :# > The code that replaces > tag: a b c d b > with > tag: [[a => a]] [[b => b]] [[c => c]] [[d => d]] > could be written > > new_content << 'tag:' > line.split[1..-1].uniq.each { | tag | new_content << " [[#{tag} => #{tag}]]" } > > Jim Nice but it misses the case where one of the tags where already changed. :alex |.::the_mindstorm::.|