Sha256: 98c8f1e456da4200d8f4334871d4cbee53a3e6144dae61d5caeaf24d0bbd7bfb
Contents?: true
Size: 633 Bytes
Versions: 1
Compression:
Stored size: 633 Bytes
Contents
module Munge class Cleaner def initialize(path_to_clean:, paths_to_write:, io:) @path_to_clean = path_to_clean @paths_to_write = paths_to_write @io = io end def orphans existing_files - @paths_to_write end def delete orphans.each { |orphan| @io.rm(orphan) } Dir.glob(File.join(@path_to_clean, "**", "*")).reverse_each do |dir| if !File.directory?(dir) next end @io.rmdir(dir) end end private def existing_files Dir.glob(File.join(@path_to_clean, "**", "*")).select { |path| File.file?(path) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
munge-0.18.0 | lib/munge/cleaner.rb |