Class: Mindee::Product::FR::Payslip::PayslipV3PaidTimeOff

Inherits:
Mindee::Parsing::Standard::FeatureField show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb

Overview

Information about paid time off.

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) ⇒ PayslipV3PaidTimeOff

Returns a new instance of PayslipV3PaidTimeOff.

Parameters:

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


30
31
32
33
34
35
36
37
38
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 30

def initialize(prediction, page_id)
  super(prediction, page_id)
  @accrued = prediction['accrued']
  @period = prediction['period']
  @pto_type = prediction['pto_type']
  @remaining = prediction['remaining']
  @used = prediction['used']
  @page_id = page_id
end

Instance Attribute Details

#accruedFloat (readonly)

The amount of paid time off accrued in the period.

Returns:

  • (Float)


14
15
16
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 14

def accrued
  @accrued
end

#periodString (readonly)

The paid time off period.

Returns:

  • (String)


17
18
19
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 17

def period
  @period
end

#pto_typeString (readonly)

The type of paid time off.

Returns:

  • (String)


20
21
22
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 20

def pto_type
  @pto_type
end

#remainingFloat (readonly)

The remaining amount of paid time off at the end of the period.

Returns:

  • (Float)


23
24
25
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 23

def remaining
  @remaining
end

#usedFloat (readonly)

The amount of paid time off used in the period.

Returns:

  • (Float)


26
27
28
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 26

def used
  @used
end

Instance Method Details

#printable_valuesHash

Returns:

  • (Hash)


41
42
43
44
45
46
47
48
49
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 41

def printable_values
  printable = {}
  printable[:accrued] = @accrued.nil? ? '' : Field.float_to_string(@accrued)
  printable[:period] = format_for_display(@period)
  printable[:pto_type] = format_for_display(@pto_type)
  printable[:remaining] = @remaining.nil? ? '' : Field.float_to_string(@remaining)
  printable[:used] = @used.nil? ? '' : Field.float_to_string(@used)
  printable
end

#table_printable_valuesHash

Returns:

  • (Hash)


52
53
54
55
56
57
58
59
60
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 52

def table_printable_values
  printable = {}
  printable[:accrued] = @accrued.nil? ? '' : Field.float_to_string(@accrued)
  printable[:period] = format_for_display(@period, 6)
  printable[:pto_type] = format_for_display(@pto_type, 11)
  printable[:remaining] = @remaining.nil? ? '' : Field.float_to_string(@remaining)
  printable[:used] = @used.nil? ? '' : Field.float_to_string(@used)
  printable
end

#to_sString

Returns:

  • (String)


75
76
77
78
79
80
81
82
83
84
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 75

def to_s
  printable = printable_values
  out_str = String.new
  out_str << "\n  :Accrued: #{printable[:accrued]}"
  out_str << "\n  :Period: #{printable[:period]}"
  out_str << "\n  :Type: #{printable[:pto_type]}"
  out_str << "\n  :Remaining: #{printable[:remaining]}"
  out_str << "\n  :Used: #{printable[:used]}"
  out_str
end

#to_table_lineString

Returns:

  • (String)


63
64
65
66
67
68
69
70
71
72
# File 'lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb', line 63

def to_table_line
  printable = table_printable_values
  out_str = String.new
  out_str << format('| %- 10s', printable[:accrued])
  out_str << format('| %- 7s', printable[:period])
  out_str << format('| %- 12s', printable[:pto_type])
  out_str << format('| %- 10s', printable[:remaining])
  out_str << format('| %- 10s', printable[:used])
  out_str << '|'
end