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

Inherits:
BaseField 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 BaseField

#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 (bool) (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_valuesHash

Hashed representation of the values.

Returns:

  • (Hash)

    Hash of the values.



34
35
36
37
38
39
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 34

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

#to_sString

Returns:

  • (String)


27
28
29
30
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 27

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

#to_table_lineString

Table line representation of the values.

Returns:

  • (String)

    The formatted table line, as a string.



21
22
23
24
# File 'lib/mindee/parsing/standard/company_registration_field.rb', line 21

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