Class: RagRuby::Document
- Inherits:
-
Object
- Object
- RagRuby::Document
- Defined in:
- lib/rag_ruby/document.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #bytesize ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(content:, metadata: {}, source: nil) ⇒ Document
constructor
A new instance of Document.
- #to_s ⇒ Object
Constructor Details
#initialize(content:, metadata: {}, source: nil) ⇒ Document
Returns a new instance of Document.
7 8 9 10 11 |
# File 'lib/rag_ruby/document.rb', line 7 def initialize(content:, metadata: {}, source: nil) @content = content @metadata = @source = source end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/rag_ruby/document.rb', line 5 def content @content end |
#metadata ⇒ Object
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/rag_ruby/document.rb', line 5 def @metadata end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/rag_ruby/document.rb', line 5 def source @source end |
Instance Method Details
#bytesize ⇒ Object
17 18 19 |
# File 'lib/rag_ruby/document.rb', line 17 def bytesize content.bytesize end |
#empty? ⇒ Boolean
21 22 23 |
# File 'lib/rag_ruby/document.rb', line 21 def empty? content.nil? || content.strip.empty? end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/rag_ruby/document.rb', line 13 def to_s content end |