Sha256: d8c494bc874b55b6e01c6c3105779a4b47070d7b17ec44c3fdf50bb05946229f

Contents?: true

Size: 637 Bytes

Versions: 3

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

module Expire
  # Hold backups for a period
  class KeepAdjectiveForRuleBase < FromNowKeepAdjectiveForRuleBase
    ADJECTIVE_FOR = {
      'week' => 'weekly',
      'month' => 'monthly',
      'year' => 'yearly'
    }.freeze

    PRIMARY_RANK = 30

    def self.primary_rank
      PRIMARY_RANK
    end

    def self.rank
      primary_rank + secondary_rank
    end

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

    def primary_rank
      self.class.primary_rank
    end

    def reason_to_keep
      "keep #{amount} #{ADJECTIVE_FOR[spacing]} #{numerus_backup}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
expire-0.2.2 lib/expire/keep_adjective_for_rule_base.rb
expire-0.2.1 lib/expire/keep_adjective_for_rule_base.rb
expire-0.2.0 lib/expire/keep_adjective_for_rule_base.rb