Class: Expire::KeepAdjectiveForRuleBase
- Inherits:
-
FromNowKeepAdjectiveForRuleBase
- Object
- RuleBase
- KeepAdjectiveRuleBase
- FromNowKeepAdjectiveForRuleBase
- Expire::KeepAdjectiveForRuleBase
- Defined in:
- lib/expire/keep_adjective_for_rule_base.rb
Overview
Hold backups for a period
Direct Known Subclasses
KeepDailyForRule, KeepHourlyForRule, KeepMonthlyForRule, KeepWeeklyForRule, KeepYearlyForRule
Constant Summary collapse
- ADJECTIVE_FOR =
{ "week" => "weekly", "month" => "monthly", "year" => "yearly" }.freeze
- PRIMARY_RANK =
30
Constants included from FromRangeValue
FromRangeValue::FROM_VALUE_REGEX
Constants inherited from KeepAdjectiveRuleBase
Expire::KeepAdjectiveRuleBase::NOUN_FOR, Expire::KeepAdjectiveRuleBase::SECONDARY_RANK_FOR
Instance Attribute Summary
Attributes inherited from FromNowKeepAdjectiveForRuleBase
Attributes inherited from RuleBase
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from FromNowKeepAdjectiveForRuleBase
Methods included from FromRangeValue
Methods included from NumerusUnit
Methods inherited from KeepAdjectiveRuleBase
#adjective, from_value, #rank, secondary_rank, #secondary_rank, #spacing
Methods inherited from RuleBase
<=>, #<=>, camelized_name, #initialize, name, #name, #numerus_backup, #option_name, option_name
Constructor Details
This class inherits a constructor from Expire::FromNowKeepAdjectiveForRuleBase
Class Method Details
.primary_rank ⇒ Object
14 15 16 |
# File 'lib/expire/keep_adjective_for_rule_base.rb', line 14 def self.primary_rank PRIMARY_RANK end |
.rank ⇒ Object
18 19 20 |
# File 'lib/expire/keep_adjective_for_rule_base.rb', line 18 def self.rank primary_rank + secondary_rank end |
Instance Method Details
#apply(backups, _) ⇒ Object
22 23 24 |
# File 'lib/expire/keep_adjective_for_rule_base.rb', line 22 def apply(backups, _) super(backups, backups.newest) end |
#primary_rank ⇒ Object
26 27 28 |
# File 'lib/expire/keep_adjective_for_rule_base.rb', line 26 def primary_rank self.class.primary_rank end |
#reason_to_keep ⇒ Object
30 31 32 |
# File 'lib/expire/keep_adjective_for_rule_base.rb', line 30 def reason_to_keep "keep #{amount} #{ADJECTIVE_FOR[spacing]} #{numerus_backup}" end |