Class: CLOC
- Inherits:
-
Object
- Object
- CLOC
- Defined in:
- lib/pluginscan/reports/cloc_report/cloc.rb
Defined Under Namespace
Classes: CSVError, LanguageCount
Instance Method Summary collapse
-
#initialize(cloc_csv) ⇒ CLOC
constructor
A new instance of CLOC.
- #language_counts ⇒ Object
Constructor Details
#initialize(cloc_csv) ⇒ CLOC
Returns a new instance of CLOC.
4 5 6 7 |
# File 'lib/pluginscan/reports/cloc_report/cloc.rb', line 4 def initialize(cloc_csv) fail "Not a CSV: #{cloc_csv}" unless cloc_csv.is_a? CSV::Table @cloc_csv = cloc_csv end |
Instance Method Details
#language_counts ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/pluginscan/reports/cloc_report/cloc.rb', line 9 def language_counts @cloc_csv.map { |row| next if row.empty? language = row["language"] sloc = Integer(row["code"]) file_count = Integer(row["files"]) LanguageCount.new(language, sloc, file_count) }.compact end |