- if @new_resource.purge
- files_to_purge = Set.new(
- Dir.glob(::File.join(@new_resource.path, '**', '*'), ::File::FNM_DOTMATCH).select do |name|
- name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
- end
- )
- files_to_purge = files_to_purge - files_transferred
- purge_unmanaged_files(files_to_purge)
- end
+
+ return unless @new_resource.purge
+
+ files_to_purge = Set.new(
+ Dir.glob(::File.join(@new_resource.path, "**", "*"), ::File::FNM_DOTMATCH).select do |name|
+ name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
+ end
+ )
+ files_to_purge -= files_transferred
+ purge_unmanaged_files(files_to_purge)