Sha256: 868f382f7862a84d90999dd350c5bd7a09eff873ba2c62a4d0c9dbdcb717403a

Contents?: true

Size: 568 Bytes

Versions: 6

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

module Expire
  # Keep the most recent backups for a
  # certain period of time.
  class KeepMostRecentForRule < FromNowKeepMostRecentForRule
    extend FromRangeValue
    include NumerusUnit

    RULE_RANK = 11

    attr_reader :unit

    def self.rank
      RULE_RANK
    end

    def apply(backups, _)
      reference_time = backups.newest
      super(backups, reference_time)
    end

    def rank
      self.class.rank
    end

    def reason_to_keep
      "keep most recent backups for #{amount} #{numerus_unit}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
expire-0.2.6 lib/expire/keep_most_recent_for_rule.rb
expire-0.2.5 lib/expire/keep_most_recent_for_rule.rb
expire-0.2.4 lib/expire/keep_most_recent_for_rule.rb
expire-0.2.3 lib/expire/keep_most_recent_for_rule.rb
expire-0.2.2 lib/expire/keep_most_recent_for_rule.rb
expire-0.2.1 lib/expire/keep_most_recent_for_rule.rb