Class: OmniAI::Mistral::OCR::Page
- Inherits:
-
Object
- Object
- OmniAI::Mistral::OCR::Page
- Defined in:
- lib/omniai/mistral/ocr/page.rb
Overview
A page returned by the OCR API.
Instance Attribute Summary collapse
-
#dimensions ⇒ Object
!@attribute [rw] dimensions @return [Dimensions].
-
#images ⇒ Object
!@attribute [rw] images @return [Array<Image>].
-
#index ⇒ Object
!@attribute [rw] index @return [Integer].
-
#markdown ⇒ Object
!@attribute [rw] markdown @return [String].
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(index:, markdown:, images:, dimensions:) ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize(index:, markdown:, images:, dimensions:) ⇒ Page
Returns a new instance of Page.
28 29 30 31 32 33 |
# File 'lib/omniai/mistral/ocr/page.rb', line 28 def initialize(index:, markdown:, images:, dimensions:) @index = index @markdown = markdown @images = images @dimensions = dimensions end |
Instance Attribute Details
#dimensions ⇒ Object
!@attribute [rw] dimensions
@return [Dimensions]
22 23 24 |
# File 'lib/omniai/mistral/ocr/page.rb', line 22 def dimensions @dimensions end |
#images ⇒ Object
!@attribute [rw] images
@return [Array<Image>]
18 19 20 |
# File 'lib/omniai/mistral/ocr/page.rb', line 18 def images @images end |
#index ⇒ Object
!@attribute [rw] index
@return [Integer]
10 11 12 |
# File 'lib/omniai/mistral/ocr/page.rb', line 10 def index @index end |
#markdown ⇒ Object
!@attribute [rw] markdown
@return [String]
14 15 16 |
# File 'lib/omniai/mistral/ocr/page.rb', line 14 def markdown @markdown end |
Class Method Details
.parse(data:) ⇒ Page
38 39 40 41 42 43 44 45 |
# File 'lib/omniai/mistral/ocr/page.rb', line 38 def self.parse(data:) new( index: data["index"], markdown: data["markdown"], images: data["images"].map { |image_data| Image.parse(data: image_data) }, dimensions: Dimensions.parse(data: data["dimensions"]) ) end |