Class: Catalog::Organizer

Inherits:
Object
  • Object
show all
Defined in:
lib/catalog/organizer.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_path:) ⇒ Organizer

Returns a new instance of Organizer.



3
4
5
# File 'lib/catalog/organizer.rb', line 3

def initialize(base_path:)
  @base_path = base_path
end

Instance Method Details

#run!Object



7
8
9
10
11
12
13
14
15
# File 'lib/catalog/organizer.rb', line 7

def run!
  new_documents.each do |document|
    matcher = DrawerMatcher.new(document: document)

    if matcher.match?
      DocumentMover.new(document: document, drawer: matcher.drawer).move!
    end
  end
end