Class: Mindee::V2::Product::Split::SplitRange
- Inherits:
-
Object
- Object
- Mindee::V2::Product::Split::SplitRange
- Defined in:
- lib/mindee/v2/product/split/split_range.rb
Overview
Split inference result.
Instance Attribute Summary collapse
-
#document_type ⇒ String
readonly
The document type, as identified on given classification values.
-
#extraction_response ⇒ Object
readonly
Returns the value of attribute extraction_response.
-
#page_range ⇒ Array<Integer>
readonly
0-based page indexes, where the first integer indicates the start page and the second integer indicates the end page.
Instance Method Summary collapse
-
#extract_from_file(input_source) ⇒ PDF::ExtractedPDF
Apply the split range inference to a file and return a single extracted PDF.
-
#initialize(server_response) ⇒ SplitRange
constructor
A new instance of SplitRange.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(server_response) ⇒ SplitRange
Returns a new instance of SplitRange.
17 18 19 20 21 22 23 24 25 |
# File 'lib/mindee/v2/product/split/split_range.rb', line 17 def initialize(server_response) @page_range = server_response['page_range'] @document_type = server_response['document_type'] # rubocop:disable Style/GuardClause unless server_response['extraction_response'].nil? @extraction_response = V2::Product::Extraction::ExtractionResponse.new(server_response['extraction_response']) end # rubocop:enable Style/GuardClause end |
Instance Attribute Details
#document_type ⇒ String (readonly)
Returns The document type, as identified on given classification values.
13 14 15 |
# File 'lib/mindee/v2/product/split/split_range.rb', line 13 def document_type @document_type end |
#extraction_response ⇒ Object (readonly)
Returns the value of attribute extraction_response.
14 15 16 |
# File 'lib/mindee/v2/product/split/split_range.rb', line 14 def extraction_response @extraction_response end |
#page_range ⇒ Array<Integer> (readonly)
Returns 0-based page indexes, where the first integer indicates the start page and the second integer indicates the end page.
11 12 13 |
# File 'lib/mindee/v2/product/split/split_range.rb', line 11 def page_range @page_range end |
Instance Method Details
#extract_from_file(input_source) ⇒ PDF::ExtractedPDF
Apply the split range inference to a file and return a single extracted PDF.
37 38 39 |
# File 'lib/mindee/v2/product/split/split_range.rb', line 37 def extract_from_file(input_source) FileOperation::Split.extract_single_split(input_source, @page_range) end |
#to_s ⇒ String
String representation.
29 30 31 |
# File 'lib/mindee/v2/product/split/split_range.rb', line 29 def to_s "* :Page Range: #{@page_range}\n :Document Type: #{@document_type}" end |