Class: RCrewAI::Knowledge::PdfSource
- Defined in:
- lib/rcrewai/knowledge/sources.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ PdfSource
constructor
A new instance of PdfSource.
- #read ⇒ Object
Constructor Details
#initialize(path) ⇒ PdfSource
Returns a new instance of PdfSource.
36 37 38 39 |
# File 'lib/rcrewai/knowledge/sources.rb', line 36 def initialize(path) super() @path = path end |
Instance Method Details
#read ⇒ Object
41 42 43 44 45 |
# File 'lib/rcrewai/knowledge/sources.rb', line 41 def read require 'pdf-reader' reader = PDF::Reader.new(@path) reader.pages.map(&:text).join("\n") end |