class Expire::KeepMostRecentRule
Keep the most recent Backups
Constants
- RULE_RANK
Public Class Methods
from_value(value)
click to toggle source
# File lib/expire/keep_most_recent_rule.rb, line 10 def self.from_value(value) return new(amount: 0) if value.none? new(amount: Integer(value)) end
rank()
click to toggle source
# File lib/expire/keep_most_recent_rule.rb, line 16 def self.rank RULE_RANK end
Public Instance Methods
apply(backups, _)
click to toggle source
# File lib/expire/keep_most_recent_rule.rb, line 24 def apply(backups, _) backups.most_recent(amount).each do |backup| backup.add_reason_to_keep(reason_to_keep) end end
rank()
click to toggle source
# File lib/expire/keep_most_recent_rule.rb, line 20 def rank self.class.rank end
Private Instance Methods
reason_to_keep()
click to toggle source
# File lib/expire/keep_most_recent_rule.rb, line 32 def reason_to_keep return 'keep the most recent backup' if amount == 1 "keep the #{amount} most recent backups" end