Class: Treat::Workers::Formatters::Readers::DOC
- Inherits:
-
Object
- Object
- Treat::Workers::Formatters::Readers::DOC
- Defined in:
- lib/treat/workers/formatters/readers/doc.rb
Overview
A wrapper for the ‘antiword’ command-line utility.
Class Method Summary collapse
-
.read(document, options = {}) ⇒ Object
Extract the readable text from a DOC file using the antiword command-line utility.
Class Method Details
.read(document, options = {}) ⇒ Object
Extract the readable text from a DOC file using the antiword command-line utility.
Options: none.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/treat/workers/formatters/readers/doc.rb', line 8 def self.read(document, = {}) f = `antiword #{document.file}` f.gsub!("\n\n", '#keep#') f.gsub!("\n", ' ') f.gsub!('#keep#', "\n\n") document.value = f document.set :format, 'doc' document end |