On 2007-01-12 17:11:54 +0100, "Phrogz" <gavin / refinery.com> said: > Josselin wrote: >> I wrote the following ruby statements.. I get the result I need , I >> tried to DRY it for 2 hours without being successfull , >> >> d = d.gsub(/\r\n/,' ') # get rid of carriage return >> d = d.gsub(/;/,' ') # replace column by space >> d = d.gsub(/,/,' ') # replace comma by space >> a = d.split(' ') # split into component , space as divider > > BTW, that is already reasonably DRY, in my opinion. Calling the same > method repeatedly but with different parameters is not "repeating > yourself". It would be WET (hrm...Way Extra Toomuchcode) if you had > something like: > > d = d.gsub( /\r\n/, ' ' ) > e = e.gsub( /\r\n/, ' ' ) > f = f.gsub( /\r\n/, ' ' ) > g = g.gsub( /\r\n/, ' ' ) > etc. > > It's just semantics, but IMO what you're asking for is to make your > code more compact (but not necessarily golfing). Thanks to all of you... as a newbie I try to keep this kind of useful comment in my mind DRY vs WET (it's now engraved...)