Paul Battley wrote: / ... > Thanks! I'm using your beautifier, and finding it pretty robust. I > edited it a little into more idiomatic Ruby (noMoreNamesLikeThis), Yes, a holdover from my Java days. I'll have to purge myself of these old habits. :) > made some things more concise, and applied a few rules of my own taste > (outdenting private and protected). > > If you're interested: > http://po-ru.com/files/beautify-ruby Nice. Better layout and more concise statement of the regexps, although your version may perhaps run slower (because each of the parenthesized tests are run against each encountered character). I haven't actually speed tested it, but it seems logical that more partial tests are being run. Don't get me wrong, I like how your layout looks. It's easier to read and understand than mine, because similar tests are grouped together. I have replied to several bug reports since the version you started with, and, since your version now looks much better than mine, perhaps you would be willing to look at my present version and incorporate a few of my recent changes: http://www.arachnoid.com/ruby/rubyBeautifier.html In particular, the beginning of the line filter now does this: # throw out sequences that will # only sow confusion while tline.gsub!(/\(.*?\)/,"") end while tline.gsub!(/\/.*?\//,"") end I did this because my original script didn't handle nested parentheses or forward slashes properly, resulting in occasional bugs. Also, "case" is now handled differently, because someone pointed out to me that this -- return case ... -- is valid Ruby syntax, and I wasn't taking this possibility into account. So now I have this test: /(^| )case\b/, And thanks for your version, it gives me some ideas. -- Paul Lutus http://www.arachnoid.com