# ========================================================= # Classe de formatage des resultats renvoyes par rake stats # Author: Vincent Dubois # ========================================================= class StatsFormatter attr_accessor :result # Constructeur def initialize result self.result = result end # Methode qui permet de fabriquer le flux HTML a partir des flux console def to_html html = "" i = 0 results = self.result.split(/$/) bottom = 4 while !results[bottom].nil? and results[bottom][0..1] != "\n+" do bottom = bottom + 1 end lines = results[4..bottom-1] lines.each do |line| elements = line.split(/\|/) html = html + "" html = html + "" html = html + "" html = html + "" html = html + "" html = html + "" html = html + "" html = html + "" html = html + "" i = i + 1 end total = results[bottom + 1] elements = total.split(/\|/) html = html + "" html = html + "" [2,3,4,5,6,7].each do |j| html = html + "" end html = html + "" html = html + "
NameLinesLOCClassesMethodsM/CLOC/M
#{elements[1]}#{elements[2]}#{elements[3]}#{elements[4]}#{elements[5]}#{elements[6]}#{elements[7]}
#{elements[1]}#{elements[j]}
" extra = results[bottom + 3] elements = extra.split(/:| /) html = html + "

#{elements[0]} : #{elements[1]}      " html = html + "#{elements[2]} : #{elements[3]}      " html = html + "#{elements[4]} : #{elements[5]}:#{elements[6]}


" end end