Class: Simplabs::Excellent::Parsing::LOCParser
- Inherits:
-
Object
- Object
- Simplabs::Excellent::Parsing::LOCParser
- 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
-
#files ⇒ Object
The files to count the lines for.
Instance Method Summary collapse
-
#count(force = false) ⇒ Object
Returns a hash with file name as key and a hash of counts as value.
-
#initialize(files) ⇒ LOCParser
constructor
:nodoc:.
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
#files ⇒ Object
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
forceto 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 |