Class: MediaArchiver::MediaFileUtils
- Inherits:
-
Object
- Object
- MediaArchiver::MediaFileUtils
- Defined in:
- lib/media_archiver/media_file_utils.rb
Instance Method Summary collapse
- #each(recursive) ⇒ Object
-
#initialize(path) ⇒ MediaFileUtils
constructor
A new instance of MediaFileUtils.
Constructor Details
#initialize(path) ⇒ MediaFileUtils
Returns a new instance of MediaFileUtils.
3 4 5 |
# File 'lib/media_archiver/media_file_utils.rb', line 3 def initialize(path) @path = path end |
Instance Method Details
#each(recursive) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/media_archiver/media_file_utils.rb', line 7 def each(recursive) scan_path(recursive) .reject { |path| File.directory? path } .each_with_object([]) do |file_path, acc| file = MediaFile.new(file_path) if file.valid? yield(file) acc << file end end end |