Class: RagRuby::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/rag_ruby/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Returns:

  • (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