Class: Coco::SourceLister
- Inherits:
-
Object
- Object
- Coco::SourceLister
- Defined in:
- lib/coco/lister/source_lister.rb
Overview
I retrieve the .rb files from a list of directories.
Instance Method Summary collapse
-
#initialize(config) ⇒ SourceLister
constructor
config - Hash.
-
#list ⇒ Object
Returns Array of String, that is a list of all ‘.rb` files from the directories found in configuration.
Constructor Details
#initialize(config) ⇒ SourceLister
config - Hash.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/coco/lister/source_lister.rb', line 7 def initialize(config) @exclude_files = config[:exclude] dirs = config[:include] @folders = [*dirs] @folders.each do |folder| unless File.directory?(folder) raise ArgumentError, "Not a folder: #{folder}" end end @list = [] end |
Instance Method Details
#list ⇒ Object
Returns Array of String, that is a list of all ‘.rb` files from the directories found in configuration.
21 22 23 24 25 26 |
# File 'lib/coco/lister/source_lister.rb', line 21 def list look_for_sources @list.map! { |file| File.(file) } exclude_files_user_dont_want if @exclude_files @list end |