Sha256: 17a39deb98514428ae18071cd7feedb94f7e6c506521d1e0ad32dc24e12a8f08

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

class CLOC
  class CSVError < StandardError; end

  def initialize(cloc_csv)
    fail "Not a CSV: #{cloc_csv}" unless cloc_csv.is_a? CSV::Table
    @cloc_csv = cloc_csv
  end

  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

  LanguageCount = Struct.new(:language, :sloc, :file_count)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 lib/pluginscan/reports/cloc_report/cloc.rb