Class: Mindee::Product::BarcodeReader::BarcodeReaderV1Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::BarcodeReader::BarcodeReaderV1Document
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb
Overview
Barcode Reader API version 1.0 document data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#codes_1d ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
List of decoded 1D barcodes.
-
#codes_2d ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
List of decoded 2D barcodes.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ BarcodeReaderV1Document
constructor
A new instance of BarcodeReaderV1Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ BarcodeReaderV1Document
Returns a new instance of BarcodeReaderV1Document.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb', line 20 def initialize(prediction, page_id) super() @codes_1d = [] prediction['codes_1d'].each do |item| @codes_1d.push(StringField.new(item, page_id)) end @codes_2d = [] prediction['codes_2d'].each do |item| @codes_2d.push(StringField.new(item, page_id)) end end |
Instance Attribute Details
#codes_1d ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
List of decoded 1D barcodes.
13 14 15 |
# File 'lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb', line 13 def codes_1d @codes_1d end |
#codes_2d ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
List of decoded 2D barcodes.
16 17 18 |
# File 'lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb', line 16 def codes_2d @codes_2d end |
Instance Method Details
#to_s ⇒ String
33 34 35 36 37 38 39 40 |
# File 'lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb', line 33 def to_s codes_1d = @codes_1d.join("\n #{' ' * 13}") codes_2d = @codes_2d.join("\n #{' ' * 13}") out_str = String.new out_str << "\n:Barcodes 1D: #{codes_1d}".rstrip out_str << "\n:Barcodes 2D: #{codes_2d}".rstrip out_str[1..].to_s end |