Sha256: b47ed98934c1bb20223b8d1dbf747018198f5a5b0b9e682a68805d233e4c9401

Contents?: true

Size: 802 Bytes

Versions: 23

Compression:

Stored size: 802 Bytes

Contents

require 'pdf-reader'
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 an AcroForm PDF file handler that returns a single table
    class AcroForm < Base
      private

      def rows(&block)
        return enum_for(:rows) unless block

        [reader.fields_hash].each(&block)
      rescue NoMethodError
        raise "Failed to read #{SafeFile.basename(@filename)} as an AcroForm PDF"
      end

      def reader
        @reader ||= AcroFormReader.new(SafeFile.safepath_to_string(@filename))
      end
    end

    Registry.register(AcroForm, 'acroform')
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ndr_import-8.5.1 lib/ndr_import/file/acro_form.rb
ndr_import-8.5.0 lib/ndr_import/file/acro_form.rb
ndr_import-8.4.0 lib/ndr_import/file/acro_form.rb