From: Robert Klemme Date: 2009-05-05T15:30:17+09:00 Subject: Re: my logroll code, please critique On 05.05.2009 03:52, matt neuburg wrote: > Derek Smith wrote: > >> if File.exists?("development.log.10.gz") >> File.copy("development.log.10.gz", "development.log.11.gz") >> end >> if File.exists?("development.log.8.gz") >> File.copy("development.log.8.gz", "development.log.9.gz") >> end >> # etc, over and over and over and over > > You forgot log.9, and the very fact that this can happen, along with the > patterned repetition here, would appear to be a Bad Smell (as in > "Refactoring"). Why 30 hard-coded lines when a 5-line loop will do? m. Another thing that struck me is the usage of File.copy. File.rename would be much more efficient plus it would not change the last modification time of the file. Kind regards robert