joeworkman/paperless — pull request #11 by unsay (2014-01-05 01:33:28+00:00)
Title: Refactor Services and OCR modules and namespacing

Hi, since there aren't tests in Paperless yet, this is a start in a direction to start making the classes more atomic and concerned with only themselves and get some familiarity with how it's architected.

I'm interested in adding Tesseract OCR support, but wasn't keen about putting more OCR Engine turds in `Paperless::Engine`.

Some things to note that I'm trying to move towards:

Have the `Engine` class "ask" the classes about what they are. For instance, I've changed this:

```ruby
ocr_engine = case @ocr_engine
when /^#{PDFPENPRO6_ENGINE}$/i then PaperlessOCR::PDFpenPro6.new
when /^#{PDFPEN6_ENGINE}$/i then PaperlessOCR::PDFpen6.new
when /^#{PDFPENPRO_ENGINE}$/i then PaperlessOCR::PDFpenPro.new
when /^#{PDFPEN_ENGINE}$/i then PaperlessOCR::PDFpen.new
when /^#{ACROBAT_ENGINE}$/i then PaperlessOCR::Acrobat.new
when /^#{DEVONTHINKPRO_ENGINE}$/i then PaperlessOCR::DevonThinkPro.new
else false
end
```

To:

```ruby
klass = Paperless::OCREngine.apply(@ocr_engine)
```

I don't have all the `Services` and `Engines` at my disposal, so I'm not sure re-jiggering the classes are 100% yet.