Class: CCReport
- Inherits:
-
Object
- Object
- CCReport
- Defined in:
- lib/cc_report.rb
Instance Method Summary collapse
- #as_csv ⇒ Object
-
#initialize(source) ⇒ CCReport
constructor
A new instance of CCReport.
Constructor Details
#initialize(source) ⇒ CCReport
Returns a new instance of CCReport.
5 6 7 8 9 |
# File 'lib/cc_report.rb', line 5 def initialize source @output = "" @analyser = ComplexityAnalyser.new @source = source end |
Instance Method Details
#as_csv ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cc_report.rb', line 11 def as_csv begin @analyser.parse @source @output += "Name, CC" @analyser.functions.each do |function| @output += "\n#{function[:name]},#{function[:complexity]}" end rescue @output = "WARNING: Could not parse \n#{source} \n: SKIPPED" end @output end |