Class: Mindee::Parsing::Standard::CompanyRegistrationField

Inherits:
Field show all
Defined in:
lib/mindee/parsing/standard/company_registration_field.rb

Overview

Company registration number or code, and its type.

Instance Attribute Summary collapse

Attributes inherited from Field

#reconstructed, #value

Attributes inherited from AbstractField

#bounding_box, #confidence, #page_id, #polygon

Instance Method Summary collapse

Methods inherited from AbstractField

array_confidence, array_sum, float_to_string

Constructor Details

#initialize(prediction, page_id, reconstructed: false) ⇒ CompanyRegistrationField

Returns a new instance of CompanyRegistrationField.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)
  • reconstructed (Boolean) (defaults to: false)


14
15
16
17
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 14

def initialize(prediction, page_id, reconstructed: false)
  super
  @type = prediction['type']
end

Instance Attribute Details

#typeString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 9

def type
  @type
end

Instance Method Details

#printable_valuesObject



29
30
31
32
33
34
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 29

def printable_values
  printable = {}
  printable['type'] = type
  printable['value'] = value
  printable
end

#to_sObject



24
25
26
27
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 24

def to_s
  printable = printable_values
  format('Type: %<type>s, Value: %<value>s', type: printable['type'], value: printable['value'])
end

#to_table_lineObject



19
20
21
22
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 19

def to_table_line
  printable = printable_values
  format('| %<type>-15s | %<value>-20s ', type: printable['type'], value: printable['value'])
end