Class: ODDB::CoMarketing::PdfParser
- Defined in:
- ext/comarketing/src/pdf_parser.rb
Defined Under Namespace
Classes: CallbackHandler
Instance Method Summary collapse
- #extract_pairs ⇒ Object
-
#initialize(path) ⇒ PdfParser
constructor
A new instance of PdfParser.
Constructor Details
#initialize(path) ⇒ PdfParser
Returns a new instance of PdfParser.
57 58 59 60 61 |
# File 'ext/comarketing/src/pdf_parser.rb', line 57 def initialize(path) open(path) { |fh| @rpdf2txt = Rpdf2txt::Parser.new(fh.read, 'UTF-8') } end |
Instance Method Details
#extract_pairs ⇒ Object
62 63 64 65 66 67 68 |
# File 'ext/comarketing/src/pdf_parser.rb', line 62 def extract_pairs handler = CallbackHandler.new catch(:vet_products) { @rpdf2txt.extract_text(handler) } handler.pairs end |