Class: Imagesorter::Categorizers::ChainedCategorizer
- Inherits:
-
Object
- Object
- Imagesorter::Categorizers::ChainedCategorizer
- Defined in:
- lib/imagesorter/categorizers/chained_categorizer.rb
Overview
Chains categorizers together, will try in order until gets a successfull result
Instance Method Summary collapse
-
#initialize(*categorizers) ⇒ ChainedCategorizer
constructor
A new instance of ChainedCategorizer.
- #process(file) ⇒ Object
- #step_name ⇒ Object
Constructor Details
#initialize(*categorizers) ⇒ ChainedCategorizer
7 8 9 |
# File 'lib/imagesorter/categorizers/chained_categorizer.rb', line 7 def initialize(*categorizers) @categorizers = categorizers end |
Instance Method Details
#process(file) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/imagesorter/categorizers/chained_categorizer.rb', line 11 def process(file) result = nil @categorizers.each do |categorizer| result = categorizer.process(file) return result unless result.nil? end end |
#step_name ⇒ Object
19 20 21 |
# File 'lib/imagesorter/categorizers/chained_categorizer.rb', line 19 def step_name 'Categorizing' end |