Class: Maglev::ExtractedDocument
- Inherits:
-
Object
- Object
- Maglev::ExtractedDocument
- Defined in:
- lib/maglev/extracted_document.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#source_identifier ⇒ Object
readonly
Returns the value of attribute source_identifier.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
- .extracted(source_identifier:, text:, metadata: {}) ⇒ Object
- .skipped(source_identifier:, reason:, metadata: {}) ⇒ Object
Instance Method Summary collapse
- #extracted? ⇒ Boolean
-
#initialize(source_identifier:, text:, metadata:, status:) ⇒ ExtractedDocument
constructor
A new instance of ExtractedDocument.
- #skipped? ⇒ Boolean
Constructor Details
#initialize(source_identifier:, text:, metadata:, status:) ⇒ ExtractedDocument
Returns a new instance of ExtractedDocument.
20 21 22 23 24 25 26 |
# File 'lib/maglev/extracted_document.rb', line 20 def initialize(source_identifier:, text:, metadata:, status:) @source_identifier = source_identifier @text = text @metadata = .freeze @status = status freeze end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/maglev/extracted_document.rb', line 5 def @metadata end |
#source_identifier ⇒ Object (readonly)
Returns the value of attribute source_identifier.
5 6 7 |
# File 'lib/maglev/extracted_document.rb', line 5 def source_identifier @source_identifier end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/maglev/extracted_document.rb', line 5 def status @status end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/maglev/extracted_document.rb', line 5 def text @text end |
Class Method Details
.extracted(source_identifier:, text:, metadata: {}) ⇒ Object
7 8 9 |
# File 'lib/maglev/extracted_document.rb', line 7 def self.extracted(source_identifier:, text:, metadata: {}) new(source_identifier: source_identifier, text: text, metadata: , status: :extracted) end |
.skipped(source_identifier:, reason:, metadata: {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/maglev/extracted_document.rb', line 11 def self.skipped(source_identifier:, reason:, metadata: {}) new( source_identifier: source_identifier, text: "", metadata: .merge(reason: reason), status: :skipped ) end |
Instance Method Details
#extracted? ⇒ Boolean
28 29 30 |
# File 'lib/maglev/extracted_document.rb', line 28 def extracted? status == :extracted end |
#skipped? ⇒ Boolean
32 33 34 |
# File 'lib/maglev/extracted_document.rb', line 32 def skipped? status == :skipped end |