Class: Mindee::Product::Resume::ResumeV1Certificate

Inherits:
Mindee::Parsing::Standard::FeatureField show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/resume/resume_v1_certificate.rb

Overview

The list of certificates obtained by the candidate.

Instance Attribute Summary collapse

Attributes inherited from Mindee::Parsing::Standard::AbstractField

#bounding_box, #confidence, #page_id, #polygon

Instance Method Summary collapse

Methods inherited from Mindee::Parsing::Standard::FeatureField

#format_for_display

Methods inherited from Mindee::Parsing::Standard::AbstractField

array_confidence, array_sum, float_to_string

Constructor Details

#initialize(prediction, page_id) ⇒ ResumeV1Certificate

Returns a new instance of ResumeV1Certificate.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)


26
27
28
29
30
31
32
33
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 26

def initialize(prediction, page_id)
  super(prediction, page_id)
  @grade = prediction['grade']
  @name = prediction['name']
  @provider = prediction['provider']
  @year = prediction['year']
  @page_id = page_id
end

Instance Attribute Details

#gradeString (readonly)

The grade obtained for the certificate.

Returns:

  • (String)


13
14
15
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 13

def grade
  @grade
end

#nameString (readonly)

The name of certification.

Returns:

  • (String)


16
17
18
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 16

def name
  @name
end

#providerString (readonly)

The organization or institution that issued the certificate.

Returns:

  • (String)


19
20
21
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 19

def provider
  @provider
end

#yearString (readonly)

The year when a certificate was issued or received.

Returns:

  • (String)


22
23
24
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 22

def year
  @year
end

Instance Method Details

#printable_valuesHash

Returns:

  • (Hash)


36
37
38
39
40
41
42
43
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 36

def printable_values
  printable = {}
  printable[:grade] = format_for_display(@grade)
  printable[:name] = format_for_display(@name)
  printable[:provider] = format_for_display(@provider)
  printable[:year] = format_for_display(@year)
  printable
end

#table_printable_valuesHash

Returns:

  • (Hash)


46
47
48
49
50
51
52
53
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 46

def table_printable_values
  printable = {}
  printable[:grade] = format_for_display(@grade, 10)
  printable[:name] = format_for_display(@name, 30)
  printable[:provider] = format_for_display(@provider, 25)
  printable[:year] = format_for_display(@year, nil)
  printable
end

#to_sString

Returns:

  • (String)


67
68
69
70
71
72
73
74
75
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 67

def to_s
  printable = printable_values
  out_str = String.new
  out_str << "\n  :Grade: #{printable[:grade]}"
  out_str << "\n  :Name: #{printable[:name]}"
  out_str << "\n  :Provider: #{printable[:provider]}"
  out_str << "\n  :Year: #{printable[:year]}"
  out_str
end

#to_table_lineString

Returns:

  • (String)


56
57
58
59
60
61
62
63
64
# File 'lib/mindee/product/resume/resume_v1_certificate.rb', line 56

def to_table_line
  printable = table_printable_values
  out_str = String.new
  out_str << format('| %- 11s', printable[:grade])
  out_str << format('| %- 31s', printable[:name])
  out_str << format('| %- 26s', printable[:provider])
  out_str << format('| %- 5s', printable[:year])
  out_str << '|'
end