Class: Ruumba::Iterators::DirectoryIterator
- Inherits:
-
Object
- Object
- Ruumba::Iterators::DirectoryIterator
- Includes:
- Enumerable
- Defined in:
- lib/ruumba/iterators.rb
Overview
Iterator which returns matching files from the given directory or file list
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(files_or_dirs, temp_dir) ⇒ DirectoryIterator
constructor
A new instance of DirectoryIterator.
Constructor Details
#initialize(files_or_dirs, temp_dir) ⇒ DirectoryIterator
Returns a new instance of DirectoryIterator.
29 30 31 32 |
# File 'lib/ruumba/iterators.rb', line 29 def initialize(files_or_dirs, temp_dir) @files_or_dirs = files_or_dirs @temp_dir = temp_dir end |
Instance Method Details
#each(&block) ⇒ Object
34 35 36 37 38 |
# File 'lib/ruumba/iterators.rb', line 34 def each(&block) files.map do |file| [file, File.read(file)] end.each(&block) end |