Sha256: da70bdbbee202d503f369aa2010e96d2ee4ce2cb14beac816c8229a3c1cefdb9
Contents?: true
Size: 885 Bytes
Versions: 53
Compression:
Stored size: 885 Bytes
Contents
require 'msworddoc-extractor' require 'ndr_support/safe_file' require_relative 'registry' module NdrImport # This is one of a collection of file handlers that deal with individual formats of data. # They can be instantiated directly or via the factory method Registry.tables module File # This class is a Word document file handler that returns a single table. # currently only works on .doc (97-2003), not.docx class Word < Base private 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 end Registry.register(Word, 'doc') # TODO: Add 'word'? end end
Version data entries
53 entries across 53 versions & 1 rubygems