Class: LOCCounter::Project
- Inherits:
-
FilesCollection
- Object
- FilesCollection
- LOCCounter::Project
- Defined in:
- lib/loc_counter/project.rb
Overview
A class representing a project.
Constant Summary collapse
- SOURCE_FILES =
Dir.glob patterns for project source code files paths
[ '*.{rb,gemspec}', '{Cap,Gem,Rake}file', 'bin/*', '{app,config,lib}/**/*.{gemspec,rake,rb}' ]
Constants inherited from FilesCollection
Instance Attribute Summary
Attributes inherited from FilesCollection
Instance Method Summary collapse
-
#initialize(dir_name) ⇒ Project
constructor
A new instance of Project.
Methods inherited from FilesCollection
Constructor Details
#initialize(dir_name) ⇒ Project
Returns a new instance of Project.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/loc_counter/project.rb', line 14 def initialize(dir_name) raise ArgumentError, "Directory '#{dir_name}' not found" unless File.exists?(dir_name) @files = [] SOURCE_FILES.each do |pattern| full_pattern = File.join(dir_name, pattern) @files += Dir.glob(full_pattern).map do |filename| SourceFile.new(filename) end end end |