ok here is mine:


class Maximizer
 attr_accessor :columnsLength
 def initialize(numColumns)
   self.columnsLength = Array.new(numColumns).fill(0)
 end

 def stretch(elems)
   columnsLength.each_index {|i|
     if elems[i].length > columnsLength[i]  
       columnsLength[i] = elems[i].length; end
   }
 end
end


numColumns = 2
splitter = /\s*(\w+)\s*=\s*(\w+)/

maxi = Maximizer.new(numColumns)


File.open("test.in") {|f|
  f.each_line {|l|
    mat = splitter.match(l.to_s)
    maxi.stretch( mat[1..numColumns] )
  }
}

fmt = ""
maxi.columnsLength.each {|cl|
  fmt += "%-#{cl+1}s"
}
fmt += "\n"

result = $stdout

File.open("test.in") {|f|
  f.each_line {|l|
    mat = splitter.match(l.to_s)
    result << fmt % mat[1..numColumns]
  }
}




probably i was wrong. this one is probably not faster.
here, it generates all arrays two times.
maybe the file must be large enough ?

markus