Class: Mindee::Parsing::Standard::FeatureField
- Inherits:
-
AbstractField
- Object
- AbstractField
- Mindee::Parsing::Standard::FeatureField
- Defined in:
- lib/mindee/parsing/standard/base_field.rb
Overview
Feature field object wrapper for specialized methods.
Direct Known Subclasses
Mindee::Product::BillOfLading::BillOfLadingV1Carrier, Mindee::Product::BillOfLading::BillOfLadingV1CarrierItem, Mindee::Product::BillOfLading::BillOfLadingV1Consignee, Mindee::Product::BillOfLading::BillOfLadingV1NotifyParty, Mindee::Product::BillOfLading::BillOfLadingV1Shipper, Mindee::Product::FR::BankAccountDetails::BankAccountDetailsV2Bban, Mindee::Product::FR::BankStatement::BankStatementV1Transaction, Mindee::Product::FR::EnergyBill::EnergyBillV1EnergyConsumer, Mindee::Product::FR::EnergyBill::EnergyBillV1EnergySupplier, Mindee::Product::FR::EnergyBill::EnergyBillV1EnergyUsage, Mindee::Product::FR::EnergyBill::EnergyBillV1MeterDetail, Mindee::Product::FR::EnergyBill::EnergyBillV1Subscription, Mindee::Product::FR::EnergyBill::EnergyBillV1TaxesAndContribution, Mindee::Product::FR::Payslip::PayslipV2BankAccountDetail, Mindee::Product::FR::Payslip::PayslipV2Employee, Mindee::Product::FR::Payslip::PayslipV2Employer, Mindee::Product::FR::Payslip::PayslipV2Employment, Mindee::Product::FR::Payslip::PayslipV2PayDetail, Mindee::Product::FR::Payslip::PayslipV2PayPeriod, Mindee::Product::FR::Payslip::PayslipV2Pto, Mindee::Product::FR::Payslip::PayslipV2SalaryDetail, Mindee::Product::FinancialDocument::FinancialDocumentV1LineItem, Mindee::Product::Invoice::InvoiceV4LineItem, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1AddedSugar, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1Calorie, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1Cholesterol, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1DietaryFiber, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1Nutrient, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1Protein, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1SaturatedFat, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1ServingSize, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1Sodium, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1TotalCarbohydrate, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1TotalFat, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1TotalSugar, Mindee::Product::NutritionFactsLabel::NutritionFactsLabelV1TransFat, Mindee::Product::Receipt::ReceiptV5LineItem, Mindee::Product::Resume::ResumeV1Certificate, Mindee::Product::Resume::ResumeV1Education, Mindee::Product::Resume::ResumeV1Language, Mindee::Product::Resume::ResumeV1ProfessionalExperience, Mindee::Product::Resume::ResumeV1SocialNetworksUrl, Mindee::Product::US::HealthcareCard::HealthcareCardV1Copay, Mindee::Product::US::UsMail::UsMailV2RecipientAddress, Mindee::Product::US::UsMail::UsMailV2SenderAddress
Instance Attribute Summary
Attributes inherited from AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#format_for_display(in_str, max_col_size = nil) ⇒ String
Format strings for display by shortening long strings and assigning empty ones.
Methods inherited from AbstractField
array_confidence, array_sum, float_to_string, #initialize, #to_s
Constructor Details
This class inherits a constructor from Mindee::Parsing::Standard::AbstractField
Instance Method Details
#format_for_display(in_str, max_col_size = nil) ⇒ String
Format strings for display by shortening long strings and assigning empty ones.
95 96 97 98 99 100 101 102 103 |
# File 'lib/mindee/parsing/standard/base_field.rb', line 95 def format_for_display(in_str, max_col_size = nil) return 'True' if in_str == true return 'False' if in_str == false return '' if in_str.nil? return in_str if max_col_size.nil? in_str = in_str.gsub(%r{[\n\r\t]}, "\n" => '\\n', "\r" => '\\r', "\t" => '\\t') in_str.length <= max_col_size ? in_str : "#{in_str[0..max_col_size - 4]}..." end |