Class: AnalysisHTMLFile
- Inherits:
-
Object
- Object
- AnalysisHTMLFile
- Defined in:
- lib/AnalysisHTMLFile.rb
Instance Method Summary collapse
- #directory ⇒ Object
-
#initialize(directory, analyzedClass) ⇒ AnalysisHTMLFile
constructor
A new instance of AnalysisHTMLFile.
- #name ⇒ Object
- #writeFile ⇒ Object
Constructor Details
#initialize(directory, analyzedClass) ⇒ AnalysisHTMLFile
Returns a new instance of AnalysisHTMLFile.
8 9 10 11 12 |
# File 'lib/AnalysisHTMLFile.rb', line 8 def initialize (directory, analyzedClass) @directory = directory @analyzedClass = analyzedClass @name = @analyzedClass.fileName.gsub("#{File.dirname(@analyzedClass.fileName)}", "").gsub("/", "") end |
Instance Method Details
#directory ⇒ Object
53 54 55 |
# File 'lib/AnalysisHTMLFile.rb', line 53 def directory @directory end |
#name ⇒ Object
57 58 59 |
# File 'lib/AnalysisHTMLFile.rb', line 57 def name @name end |
#writeFile ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/AnalysisHTMLFile.rb', line 14 def writeFile FileUtils::mkdir_p "#{@directory}" @fileHtml = File.new("#{@directory}/#{@name}.html", "w+") @fileHtml.puts "<HTML><BODY>" @fileHtml.puts "<pre>" funcCurlyBraces = 0 isInFunction = false puts @analyzedClass.fileName f = File.open(@analyzedClass.fileName, "r") f.each_line do |line| if @analyzedClass.isLineWithTestedFunction line isInFunction = true end if isInFunction if line.include? "{" funcCurlyBraces += 1 end if line.include? "}" funcCurlyBraces -= 1 end @fileHtml.puts "<font size=\"3\" color=\"#52CC52\">#{line.chomp}</font>" if funcCurlyBraces == 0 isInFunction = false end else @fileHtml.puts "<code>#{line.chomp}</code>" end end f.close @fileHtml.puts "</pre>" @fileHtml.puts "</BODY></HTML>" @fileHtml.close() end |