# File lib/expire/from_now_keep_adjective_for_rule_base.rb, line 11 def self.primary_rank PRIMARY_RANK end
class Expire::FromNowKeepAdjectiveForRuleBase
Base class for from-now rules
Constants
- PRIMARY_RANK
Attributes
unit[R]
Public Class Methods
new(unit:, **args)
click to toggle source
Calls superclass method
# File lib/expire/from_now_keep_adjective_for_rule_base.rb, line 15 def initialize(unit:, **args) super(**args) @unit = unit end
primary_rank()
click to toggle source
Public Instance Methods
apply(backups, reference_datetime)
click to toggle source
# File lib/expire/from_now_keep_adjective_for_rule_base.rb, line 23 def apply(backups, reference_datetime) minimal_datetime = reference_datetime - amount.send(unit) kept = backups.one_per(spacing).not_older_than(minimal_datetime) kept.each { |backup| backup.add_reason_to_keep(reason_to_keep) } end
primary_rank()
click to toggle source
# File lib/expire/from_now_keep_adjective_for_rule_base.rb, line 30 def primary_rank self.class.primary_rank end
reason_to_keep()
click to toggle source
# File lib/expire/from_now_keep_adjective_for_rule_base.rb, line 34 def reason_to_keep "from now keep all backups for #{amount} #{numerus_unit}" end