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.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/coco/lister/source_lister.rb', line 9 def initialize config @exclude_files = config[:excludes] dirs = config[:directories] unless dirs.is_a? Array @folders = [dirs] else @folders = dirs end @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.
27 28 29 30 31 32 |
# File 'lib/coco/lister/source_lister.rb', line 27 def list look_for_sources @list.map! {|file| File.(file)} exclude_files_user_dont_want @list end |