Class: Mindee::Product::FR::Payslip::PayslipV3SalaryDetail
- Inherits:
-
Mindee::Parsing::Standard::FeatureField
- Object
- Mindee::Parsing::Standard::AbstractField
- Mindee::Parsing::Standard::FeatureField
- Mindee::Product::FR::Payslip::PayslipV3SalaryDetail
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb
Overview
Detailed information about the earnings.
Instance Attribute Summary collapse
-
#amount ⇒ Float
readonly
The amount of the earning.
-
#base ⇒ Float
readonly
The base rate value of the earning.
-
#description ⇒ String
readonly
The description of the earnings.
-
#number ⇒ Float
readonly
The number of units in the earning.
-
#rate ⇒ Float
readonly
The rate of the earning.
Attributes inherited from Mindee::Parsing::Standard::AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ PayslipV3SalaryDetail
constructor
A new instance of PayslipV3SalaryDetail.
- #printable_values ⇒ Hash
- #table_printable_values ⇒ Hash
- #to_s ⇒ String
- #to_table_line ⇒ String
Methods inherited from Mindee::Parsing::Standard::FeatureField
Methods inherited from Mindee::Parsing::Standard::AbstractField
array_confidence, array_sum, float_to_string
Constructor Details
#initialize(prediction, page_id) ⇒ PayslipV3SalaryDetail
Returns a new instance of PayslipV3SalaryDetail.
30 31 32 33 34 35 36 37 38 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 30 def initialize(prediction, page_id) super(prediction, page_id) @amount = prediction['amount'] @base = prediction['base'] @description = prediction['description'] @number = prediction['number'] @rate = prediction['rate'] @page_id = page_id end |
Instance Attribute Details
#amount ⇒ Float (readonly)
The amount of the earning.
14 15 16 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 14 def amount @amount end |
#base ⇒ Float (readonly)
The base rate value of the earning.
17 18 19 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 17 def base @base end |
#description ⇒ String (readonly)
The description of the earnings.
20 21 22 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 20 def description @description end |
#number ⇒ Float (readonly)
The number of units in the earning.
23 24 25 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 23 def number @number end |
#rate ⇒ Float (readonly)
The rate of the earning.
26 27 28 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 26 def rate @rate end |
Instance Method Details
#printable_values ⇒ Hash
41 42 43 44 45 46 47 48 49 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 41 def printable_values printable = {} printable[:amount] = @amount.nil? ? '' : Field.float_to_string(@amount) printable[:base] = @base.nil? ? '' : Field.float_to_string(@base) printable[:description] = format_for_display(@description) printable[:number] = @number.nil? ? '' : Field.float_to_string(@number) printable[:rate] = @rate.nil? ? '' : Field.float_to_string(@rate) printable end |
#table_printable_values ⇒ Hash
52 53 54 55 56 57 58 59 60 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 52 def table_printable_values printable = {} printable[:amount] = @amount.nil? ? '' : Field.float_to_string(@amount) printable[:base] = @base.nil? ? '' : Field.float_to_string(@base) printable[:description] = format_for_display(@description, 36) printable[:number] = @number.nil? ? '' : Field.float_to_string(@number) printable[:rate] = @rate.nil? ? '' : Field.float_to_string(@rate) printable end |
#to_s ⇒ String
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 75 def to_s printable = printable_values out_str = String.new out_str << "\n :Amount: #{printable[:amount]}" out_str << "\n :Base: #{printable[:base]}" out_str << "\n :Description: #{printable[:description]}" out_str << "\n :Number: #{printable[:number]}" out_str << "\n :Rate: #{printable[:rate]}" out_str end |
#to_table_line ⇒ String
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb', line 63 def to_table_line printable = table_printable_values out_str = String.new out_str << format('| %- 13s', printable[:amount]) out_str << format('| %- 10s', printable[:base]) out_str << format('| %- 37s', printable[:description]) out_str << format('| %- 7s', printable[:number]) out_str << format('| %- 10s', printable[:rate]) out_str << '|' end |