Class: Util::ExtractPdfText
Instance Attribute Summary collapse
-
#extracted_text ⇒ Object
readonly
Returns the value of attribute extracted_text.
Instance Method Summary collapse
-
#initialize(pdf) ⇒ ExtractPdfText
constructor
A new instance of ExtractPdfText.
- #read_text ⇒ Object
Constructor Details
#initialize(pdf) ⇒ ExtractPdfText
Returns a new instance of ExtractPdfText.
5 6 7 8 9 |
# File 'lib/utilities/extract_pdf_text.rb', line 5 def initialize(pdf) @pdf = pdf @extracted_text = '' read_text end |
Instance Attribute Details
#extracted_text ⇒ Object (readonly)
Returns the value of attribute extracted_text.
11 12 13 |
# File 'lib/utilities/extract_pdf_text.rb', line 11 def extracted_text @extracted_text end |
Instance Method Details
#read_text ⇒ Object
13 14 15 16 17 18 |
# File 'lib/utilities/extract_pdf_text.rb', line 13 def read_text reader = PDF::Reader.new(@pdf.path) reader.pages.each do |page| @extracted_text += page.text end end |