Class: Munge::System::Readers::Filesystem
- Inherits:
-
Object
- Object
- Munge::System::Readers::Filesystem
- Includes:
- Enumerable
- Defined in:
- lib/munge/system/readers/filesystem.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(source_path) ⇒ Filesystem
constructor
A new instance of Filesystem.
Constructor Details
#initialize(source_path) ⇒ Filesystem
Returns a new instance of Filesystem.
7 8 9 |
# File 'lib/munge/system/readers/filesystem.rb', line 7 def initialize(source_path) @source_path = source_path end |
Instance Method Details
#each ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/munge/system/readers/filesystem.rb', line 11 def each return enum_for(:each) unless block_given? filepaths = Dir.glob(File.join(@source_path, "**", "*")) .select { |path| File.file?(path) } filepaths.each do |abspath| filehash = Hash[ relpath: compute_relpath(abspath), content: compute_content(abspath), stat: compute_stat(abspath) ] yield filehash end end |