Sha256: cc25ceccaa5233244668921617c5dd5a7b8aa92177444be29fedc1f7537ef842
Contents?: true
Size: 829 Bytes
Versions: 10
Compression:
Stored size: 829 Bytes
Contents
require 'docx' 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 modern Word document file handler that returns a single table. # It only works on .docx documents class Docx < Base private def rows(&block) return enum_for(:rows) unless block doc = ::Docx::Document.open(SafeFile.safepath_to_string(@filename)) doc.paragraphs.each do |p| yield(p.to_s) end rescue StandardError => e raise("#{SafeFile.basename(@filename)} [#{e.class}: #{e.message}]") end end Registry.register(Docx, 'docx') end end
Version data entries
10 entries across 10 versions & 1 rubygems