Class: Exegesis::FileSearcher
- Inherits:
-
Object
- Object
- Exegesis::FileSearcher
- Defined in:
- lib/exegesis/file_searcher.rb
Instance Method Summary collapse
-
#content ⇒ Object
All of the content from the given path.
-
#directories ⇒ Object
All of the directories in the given path.
-
#files ⇒ Object
All of the files in the given path.
-
#initialize(parent, fs_interface = File) ⇒ FileSearcher
constructor
Create a new FileSearcher on the given path.
- #inspect ⇒ Object
Constructor Details
#initialize(parent, fs_interface = File) ⇒ FileSearcher
Create a new FileSearcher on the given path
23 24 25 26 |
# File 'lib/exegesis/file_searcher.rb', line 23 def initialize(parent, fs_interface = File) @fs_interface = fs_interface @parent = parent end |
Instance Method Details
#content ⇒ Object
All of the content from the given path
43 44 45 |
# File 'lib/exegesis/file_searcher.rb', line 43 def content Dir[File.join(parent.path, '*')] end |
#directories ⇒ Object
All of the directories in the given path
29 30 31 32 33 |
# File 'lib/exegesis/file_searcher.rb', line 29 def directories content. select { |s| fs_interface.directory?(s) }. map { |s| Directory.create(parent, fs_interface.basename(s)) } end |
#files ⇒ Object
All of the files in the given path
36 37 38 39 40 |
# File 'lib/exegesis/file_searcher.rb', line 36 def files content. select { |s| fs_interface.file?(s) }. map { |s| SourceFile.create(parent, fs_interface.basename(s)) } end |
#inspect ⇒ Object
47 48 49 |
# File 'lib/exegesis/file_searcher.rb', line 47 def inspect "FileSearcher(#{parent.path.inspect})" end |