class Expire::RuleBase
Base class of all rules
Attributes
amount[R]
Public Class Methods
<=>(other)
click to toggle source
# File lib/expire/rule_base.rb, line 8 def self.<=>(other) rank <=> other.rank end
camelized_name()
click to toggle source
# File lib/expire/rule_base.rb, line 12 def self.camelized_name match = to_s.match(/\A.*::(.+)Rule\z/) || return match[1] end
name()
click to toggle source
# File lib/expire/rule_base.rb, line 17 def self.name camelized_name&.underscore end
new(amount:)
click to toggle source
# File lib/expire/rule_base.rb, line 26 def initialize(amount:) @amount = amount end
option_name()
click to toggle source
# File lib/expire/rule_base.rb, line 21 def self.option_name rule_name = name || return "--#{rule_name.dasherize}" end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/expire/rule_base.rb, line 45 def <=>(other) rank <=> other.rank end
name()
click to toggle source
# File lib/expire/rule_base.rb, line 32 def name camelized_name&.underscore end
numerus_backup()
click to toggle source
# File lib/expire/rule_base.rb, line 36 def numerus_backup 'backup'.pluralize(amount) end
option_name()
click to toggle source
# File lib/expire/rule_base.rb, line 40 def option_name rule_name = name || return "--#{rule_name.dasherize}" end
Private Instance Methods
camelized_name()
click to toggle source
# File lib/expire/rule_base.rb, line 51 def camelized_name match = self.class.to_s.match(/\A.*::(.+)Rule\z/) || return match[1] end