Class: Imagesorter::Categorizers::ChainedCategorizer

Inherits:
Object
  • Object
show all
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

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_nameObject



19
20
21
# File 'lib/imagesorter/categorizers/chained_categorizer.rb', line 19

def step_name
  'Categorizing'
end