Class: Simplabs::Excellent::Parsing::LOCParser

Inherits:
Object
  • Object
show all
Defined in:
lib/simplabs/excellent/parsing/loc_parser.rb

Overview

Parser that counts the different types of lines for the given set of files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files) ⇒ LOCParser

:nodoc:



15
16
17
# File 'lib/simplabs/excellent/parsing/loc_parser.rb', line 15

def initialize(files) #:nodoc:
  @files  = collect_files(files)
end

Instance Attribute Details

#filesObject

The files to count the lines for



13
14
15
# File 'lib/simplabs/excellent/parsing/loc_parser.rb', line 13

def files
  @files
end

Instance Method Details

#count(force = false) ⇒ Object

Returns a hash with file name as key and a hash of counts as value.

{ file => { :total => 9, :code => 3, ... }, ... }

Parameters

  • force - The count is cached once it was calculated. Specify force to force recalculation.


26
27
28
# File 'lib/simplabs/excellent/parsing/loc_parser.rb', line 26

def count(force = false)
  @count = recount if @count.nil? || force
end