Sha256: 58bf14fae6c8f366e2e0c7710776f6c42b88e9e30e87f4f0a83bb4557dc77764
Contents?: true
Size: 514 Bytes
Versions: 3
Compression:
Stored size: 514 Bytes
Contents
require "fileutils" module DailyWeeklyMonthly class Cleaner def initialize backups_dir, output_extension @backups_dir = backups_dir @output_extension = output_extension end def call dir, number_to_keep old_backups(dir, number_to_keep).each do |file| FileUtils.rm file end end def old_backups dir, number_to_keep Dir[File.join(@backups_dir, dir, "*.#{@output_extension}")] .sort .reverse .drop(number_to_keep) end end end
Version data entries
3 entries across 3 versions & 1 rubygems