Class: Prune::Category
- Inherits:
-
Object
- Object
- Prune::Category
- Defined in:
- lib/prune/category.rb
Overview
A category indicates how a file has been classified. These are defined in the retention policy, whether that be a project-specific one or the core retention policy. This is the primary abstraction used to decide what to do with a file.
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#description ⇒ Object
Returns the value of attribute description.
Instance Method Summary collapse
- #includes?(filename) ⇒ Boolean
-
#initialize(description, action, quiet = false, predicate = Proc.new { |x| true }) ⇒ Category
constructor
A new instance of Category.
- #quiet? ⇒ Boolean
- #requires_prompt? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(description, action, quiet = false, predicate = Proc.new { |x| true }) ⇒ Category
Returns a new instance of Category.
9 10 11 12 13 14 |
# File 'lib/prune/category.rb', line 9 def initialize( description, action, quiet = false, predicate = Proc.new { |x| true } ) @description = description @action = action @predicate = predicate @quiet = quiet end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
7 8 9 |
# File 'lib/prune/category.rb', line 7 def action @action end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/prune/category.rb', line 7 def description @description end |
Instance Method Details
#includes?(filename) ⇒ Boolean
27 28 29 |
# File 'lib/prune/category.rb', line 27 def includes?( filename ) @predicate.call filename end |
#quiet? ⇒ Boolean
31 32 33 |
# File 'lib/prune/category.rb', line 31 def quiet? @quiet end |
#requires_prompt? ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/prune/category.rb', line 16 def requires_prompt? case @action when :remove true when :archive true else false end end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/prune/category.rb', line 35 def to_s @description end |