class NdrImport::File::Word

This class is a Word document file handler that returns a single table. currently only works on .doc (97-2003), not.docx

Private Instance Methods

rows(&block) click to toggle source
# File lib/ndr_import/file/word.rb, line 14
def rows(&block)
  return enum_for(:rows) unless block

  doc = MSWordDoc::Extractor.load(SafeFile.safepath_to_string(@filename))

  doc.whole_contents.split("\n").each do |line|
    block.call(line)
  end

rescue => e
  raise("#{SafeFile.basename(@filename)} [#{e.class}: #{e.message}]")
end