Sha256: 212c63014ad13d505da8d73d8602fea7648fed33461b7a8d72428e1dc2e914d5

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

# Responsible for accessing specific data in the output of the `sloccount` command
class SLOCCount
  def initialize(sloccount_output)
    @sloccount_output = sloccount_output
  end

  def total
    total_regex = /^Total Physical Source Lines of Code.*= ([\d\,]+)/
    # Numbers in sloccount are displayed with commas e.g. 1,791
    @sloccount_output.match(total_regex)[1].delete(',').to_i
  end
end

# TODO: should be ZeroSLOCCount? More descriptive, but less obvious it's null object pattern
class NullSLOCCount
  def total
    0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 lib/pluginscan/reports/sloccount_report/sloccount.rb