Class: Report

Inherits:
Object
  • Object
show all
Defined in:
lib/report.rb

Class Method Summary collapse

Class Method Details

.cc_report_for(file) ⇒ Object



21
22
23
24
# File 'lib/report.rb', line 21

def self.cc_report_for file
  contents = File.open(file, 'r') { |f| f.read }
  CCReport.new(contents).as_csv
end

.for(file_path) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/report.rb', line 4

def self.for file_path
  output = ""
  if (File.directory? file_path)
    Dir.chdir(file_path) do
      output += "\nDir: #{file_path}\n"
      Dir.glob(File.join("**", "*.js")).each do |file|
        output += "File: #{file}\n"
        output += "\n" + Report.cc_report_for(file)
        end
    end
  else
    output += "\nFile: #{file_path}\n"
    output += Report.cc_report_for file_path
  end
  output
end