onoma 0.4.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/LICENSE.md +609 -0
- data/config/locales/arb.yml +0 -35
- data/config/locales/cmn.yml +0 -32
- data/config/locales/deu.yml +0 -15
- data/config/locales/eng.yml +63 -40
- data/config/locales/fra.yml +58 -89
- data/config/locales/ita.yml +0 -22
- data/config/locales/jpn.yml +0 -32
- data/config/locales/por.yml +0 -21
- data/config/locales/spa.yml +0 -30
- data/lib/onoma.rb +3 -1
- data/lib/onoma/item.rb +32 -19
- data/lib/onoma/migration/actions/item_change.rb +5 -5
- data/lib/onoma/migration/actions/item_creation.rb +4 -5
- data/lib/onoma/migration/actions/nomenclature_change.rb +1 -0
- data/lib/onoma/migration/actions/nomenclature_creation.rb +8 -1
- data/lib/onoma/migration/actions/property_creation.rb +2 -1
- data/lib/onoma/migration/base.rb +1 -0
- data/lib/onoma/migrator/translation.rb +2 -1
- data/lib/onoma/nomenclature.rb +57 -24
- data/lib/onoma/nomenclature_set.rb +3 -0
- data/lib/onoma/property_nature.rb +1 -0
- data/lib/onoma/record/base.rb +4 -2
- data/lib/onoma/version.rb +2 -2
- data/onoma.gemspec +14 -12
- metadata +54 -285
- data/.gitignore +0 -13
- data/.gitlab-ci.yml +0 -14
- data/.travis.yml +0 -4
- data/LICENSE.txt +0 -21
- data/db/migrate/20150813022423_add_data.xml +0 -5740
- data/db/migrate/20150813224145_fix_zea.xml +0 -14
- data/db/migrate/20150813224155_fix_hordeum.xml +0 -175
- data/db/migrate/20150814104907_rename_charts_of_accounts.xml +0 -4
- data/db/migrate/20150817202608_rename_abaci.xml +0 -19
- data/db/migrate/20150818132801_add_vinifera_product_exchangers.xml +0 -4
- data/db/migrate/20150818152001_add_wine_bottles.xml +0 -13
- data/db/migrate/20150818232501_add_vinifera_sale_exchangers.xml +0 -4
- data/db/migrate/20150820212931_remove_abaci.xml +0 -19
- data/db/migrate/20150821082601_add_grain_variants.xml +0 -4
- data/db/migrate/20150821230800_rename_invalid_document_natures.xml +0 -12
- data/db/migrate/20150825180658_add_production_usages.xml +0 -5
- data/db/migrate/20150826091319_add_leguminous_crop.xml +0 -11
- data/db/migrate/20150826092813_add_cannabis_varieties.xml +0 -51
- data/db/migrate/20150826100013_add_thicket_varieties.xml +0 -9
- data/db/migrate/20150826103353_add_eis_plant.xml +0 -31
- data/db/migrate/20150902081701_add_garden_varieties.xml +0 -7
- data/db/migrate/20150905094701_add_milklic_individual_production_exchangers.xml +0 -4
- data/db/migrate/20150914095928_add_meteorological_analysis_nature.xml +0 -46
- data/db/migrate/20150916110501_add_grain_analysis.xml +0 -5
- data/db/migrate/20150916151652_fix_product_nature_variant_units.xml +0 -515
- data/db/migrate/20150919123840_fix_plant_varieties.xml +0 -36
- data/db/migrate/20150919223801_change_walnut_nature.xml +0 -6
- data/db/migrate/20150920212201_add_fruit_harvest.xml +0 -4
- data/db/migrate/20150921104001_add_fuel_consumption_indicator.xml +0 -7
- data/db/migrate/20150921110601_add_crumbs_exchangers.xml +0 -4
- data/db/migrate/20150921175601_add_units_liter_per_hour.xml +0 -4
- data/db/migrate/20151001154701_add_missing_variants.xml +0 -9
- data/db/migrate/20151019090110_add_json_exchange_natures.xml +0 -11
- data/db/migrate/20151021172901_add_missing_indicator_on_animals.xml +0 -12
- data/db/migrate/20151027095601_add_missing_issue_natures.xml +0 -6
- data/db/migrate/20151102110723_add_daily_nitrogen_production_indicator.xml +0 -4
- data/db/migrate/20151107122501_add_cap_statements_exchangers.xml +0 -4
- data/db/migrate/20151111212501_add_missing_cap_productions.xml +0 -15
- data/db/migrate/20151117192943_change_procedure_nomenclatures.xml +0 -159
- data/db/migrate/20151122101101_add_missing_tropical_cap_varieties.xml +0 -33
- data/db/migrate/20151125163801_add_missing_varieties.xml +0 -7
- data/db/migrate/20151209000401_add_missing_crop_sets.xml +0 -12
- data/db/migrate/20151209011801_add_missing_varieties.xml +0 -45
- data/db/migrate/20151209094701_add_oleaginous_missing_varieties.xml +0 -11
- data/db/migrate/20151209103601_add_proteaginous_missing_varieties.xml +0 -6
- data/db/migrate/20151210150144_add_daucus_carota_varieties.xml +0 -38
- data/db/migrate/20151210163440_add_phaseolus_varieties.xml +0 -11
- data/db/migrate/20151210164511_add_allium_porrum_varieties.xml +0 -13
- data/db/migrate/20151210170103_add_allium_cepa_varieties.xml +0 -6
- data/db/migrate/20151211114316_add_beta_varieties.xml +0 -4
- data/db/migrate/20151211115500_add_brassica_varieties.xml +0 -50
- data/db/migrate/20151211124757_add_allium_schoenoprasum_varieties.xml +0 -4
- data/db/migrate/20151211132045_add_cucurbita_varieties.xml +0 -13
- data/db/migrate/20151211143806_add_spinacia_oleracea_varieties.xml +0 -5
- data/db/migrate/20151211151402_add_lactuca_varieties.xml +0 -6
- data/db/migrate/20151211153218_add_zea_mays_varieties.xml +0 -46
- data/db/migrate/20151214084817_add_hordeum_varieties.xml +0 -5
- data/db/migrate/20151214085342_add_pastinaca_sativa_varieties.xml +0 -4
- data/db/migrate/20151214085721_add_pisum_sativum_varieties.xml +0 -8
- data/db/migrate/20151214090420_add_solanum_tuberosum_varieties.xml +0 -4
- data/db/migrate/20151214091020_add_raphanus_varieties.xml +0 -8
- data/db/migrate/20151214092727_add_glycine_max_varieties.xml +0 -4
- data/db/migrate/20151215132825_add_abilities.xml +0 -7
- data/db/migrate/20151215133320_add_equipment_variants.xml +0 -43
- data/db/migrate/20151215214901_add_openwheatermap_identifiers.xml +0 -5
- data/db/migrate/20151216095351_add_ridger_equipment_variants.xml +0 -4
- data/db/migrate/20151216100708_add_lifter_equipment_variants.xml +0 -4
- data/db/migrate/20151216160914_add_raphanus_sativus_varieties.xml +0 -4
- data/db/migrate/20151216182551_add_more_units.xml +0 -7
- data/db/migrate/20151218081701_add_crops_issue_natures.xml +0 -11
- data/db/migrate/20151222162657_add_varieties.xml +0 -18
- data/db/migrate/20151222180021_remove_population.xml +0 -402
- data/db/migrate/20151223164501_update_organic_fertilizer.xml +0 -4
- data/db/migrate/20151223171801_update_indicators.xml +0 -4
- data/db/migrate/20160104145418_add_matters.xml +0 -14
- data/db/migrate/20160104160843_change_product_nature_variants_drain.xml +0 -4
- data/db/migrate/20160105095120_add_plugin_cap_varieties.xml +0 -261
- data/db/migrate/20160106095232_add_orchard_plugin_cap_varieties.xml +0 -405
- data/db/migrate/20160108142009_add_product_nature_variants_nematicide.xml +0 -6
- data/db/migrate/20160113144856_update_prunus_avium_parent.xml +0 -32
- data/db/migrate/20160115090243_change_plant_varieties.xml +0 -7
- data/db/migrate/20160119115401_add_shipping_note_document.xml +0 -4
- data/db/migrate/20160128093149_fixes_invalid_parent.xml +0 -102
- data/db/migrate/20160128154202_add_product_natures_protective_canvas.xml +0 -6
- data/db/migrate/20160204115942_change_protective_net_nature.xml +0 -4
- data/db/migrate/20160204122030_change_cover_implanter_abilities.xml +0 -6
- data/db/migrate/20160206163031_simplifies_activity_families.xml +0 -135
- data/db/migrate/20160207142352_fix_spelling_mistakes_on_associate_accounts.xml +0 -7
- data/db/migrate/20160210124624_fix_invalid_abilities_on_product_natures.xml +0 -5
- data/db/migrate/20160224234901_add_seedling_sorting.xml +0 -4
- data/db/migrate/20160310145038_add_rhodes_grass.xml +0 -5
- data/db/migrate/20160315152217_remove_exchange_natures.xml +0 -4
- data/db/migrate/20160402125244_add_some_heavy_equipment.xml +0 -14
- data/db/migrate/20160408223901_change_zea_variety.xml +0 -14
- data/db/migrate/20160410082230_add_chemical_classifications.xml +0 -486
- data/db/migrate/20160425100840_add_product_nature_corn_topper.xml +0 -6
- data/db/migrate/20160427115742_add_production_systems.xml +0 -9
- data/db/migrate/20160428085808_add_rows_count_indicator.xml +0 -4
- data/db/migrate/20160503131928_add_equipment_indicators.xml +0 -34
- data/db/migrate/20160503155351_fix_taxes.xml +0 -15
- data/db/migrate/20160504143733_add_units.xml +0 -6
- data/db/migrate/20160509100749_change_item_corn_topper.xml +0 -4
- data/db/migrate/20160516075201_add_plant_analysis.xml +0 -4
- data/db/migrate/20160520144901_update_plant_analysis.xml +0 -5
- data/db/migrate/20160525073342_update_spreader_trailer_product_nature.xml +0 -4
- data/db/migrate/20160526075245_update_spreader_trailer_abilities.xml +0 -4
- data/db/migrate/20160526092246_update_product_natures_and_variants_for_vegetables.xml +0 -37
- data/db/migrate/20160527090330_update_product_natures_seed.xml +0 -5
- data/db/migrate/20160531071525_add_procedure_actions.xml +0 -6
- data/db/migrate/20160531094927_add_items_for_pollination_pocedure.xml +0 -9
- data/db/migrate/20160605122001_add_worker_register.xml +0 -4
- data/db/migrate/20160608075549_update_spatial_reference_systems.xml +0 -5437
- data/db/migrate/20160608202134_add_missing_procedure_actions.xml +0 -6
- data/db/migrate/20160613154204_add_product_nature_variants_hoe_weeder.xml +0 -6
- data/db/migrate/20160615121350_add_pivots_in_nomenclature.xml +0 -11
- data/db/migrate/20160615122805_add_daily_average_working_time_indicator_and_lifespan_indicators.xml +0 -6
- data/db/migrate/20160617142409_add_items_for_hay_bales.xml +0 -8
- data/db/migrate/20160622121241_add_procedure_action_conservation_plowing.xml +0 -4
- data/db/migrate/20160624073237_add_musca_varieties.xml +0 -5
- data/db/migrate/20160627095008_add_weeding_kit.xml +0 -5
- data/db/migrate/20160630075849_update_product_nature_additive.xml +0 -4
- data/db/migrate/20160630124401_fix_coop_variants.xml +0 -9
- data/db/migrate/20160719094049_add_new_procedure_actions.xml +0 -6
- data/db/migrate/20160719100836_add_issue_nature.xml +0 -4
- data/db/migrate/20160720144130_update_equipment_varieties.xml +0 -33
- data/db/migrate/20160721124220_update_product_natures_varieties.xml +0 -58
- data/db/migrate/20160725182008_fix_abilities_on_old_equipment.xml +0 -4
- data/db/migrate/20160726173309_rename_equipments_to_equipment.xml +0 -6
- data/db/migrate/20160727092830_update_malus_pumila_variety_name.xml +0 -4
- data/db/migrate/20160802123639_update_unit_name_for_equipment_product_nature_variants.xml +0 -39
- data/db/migrate/20160816083232_add_issue_natures.xml +0 -6
- data/db/migrate/20160819082951_Add_plant_varieties.xml +0 -10
- data/db/migrate/20160829072846_add_procedure_action.xml +0 -4
- data/db/migrate/20160830153251_add_new_varieties.xml +0 -6
- data/db/migrate/20160909225801_add_missing_stock_variation_accounts.xml +0 -17
- data/db/migrate/20160911091901_update_product_nature_categories.xml +0 -53
- data/db/migrate/20160912182501_fix_product_nature_categories.xml +0 -5
- data/db/migrate/20160914114043_add_tool_maintaining_support.xml +0 -7
- data/db/migrate/20160915143142_add_pest_related_indicators.xml +0 -5
- data/db/migrate/20160919210501_add_transportation_actions.xml +0 -4
- data/db/migrate/20160928113101_add_missing_general_accounts.xml +0 -108
- data/db/migrate/20160930091201_add_missing_tax_natures.xml +0 -17
- data/db/migrate/20161017090516_fix_product_nature_categories_stock_movement_account.xml +0 -5
- data/db/migrate/20161019133613_add_ednotif_eu_country_code.xml +0 -33
- data/db/migrate/20161019145441_add_ednotif_animal_indicators.xml +0 -22
- data/db/migrate/20161022103401_add_portuguese_chart_of_account.xml +0 -34
- data/db/migrate/20161024115013_add_ednotif_indicators_to_cow_product_natures.xml +0 -7
- data/db/migrate/20161030174001_add_missing_cap_2016_varieties.xml +0 -13
- data/db/migrate/20161103111303_add_plants_sorting_action.xml +0 -4
- data/db/migrate/20161202083820_add_new_plant_varieties.xml +0 -13
- data/db/migrate/20161212181852_add_procedure_categories.xml +0 -5
- data/db/migrate/20161214093347_add_procedure_actions.xml +0 -10
- data/db/migrate/20161219171601_add_missing_vat_accounts.xml +0 -4
- data/db/migrate/20161219231801_add_outgoing_payment_report.xml +0 -4
- data/db/migrate/20170104161824_add_indicators_for_plant_analysis.xml +0 -6
- data/db/migrate/20170201180806_set_animal_group_population_counting_to_unitary.xml +0 -23
- data/db/migrate/20170203132125_update_momenclature_for_animal_housing_mulching_procedure.xml +0 -7
- data/db/migrate/20170206125311_update_nomenclature_for_animal_housing_disinfection_procedure.xml +0 -5
- data/db/migrate/20170206163322_update_disinfectant_product_variant.xml +0 -4
- data/db/migrate/20170214125925_clean_cow_indicators.xml +0 -8
- data/db/migrate/20170216100144_add_algerian_vat.xml +0 -10
- data/db/migrate/20170219210901_add_fixed_asset_registry.xml +0 -4
- data/db/migrate/20170220211447_add_procedure_category.xml +0 -4
- data/db/migrate/20170220222412_add_procedure_action.xml +0 -4
- data/db/migrate/20170221102405_add_milking_robot_in_nomenclature.xml +0 -6
- data/db/migrate/20170222113119_add_animal_varieties.xml +0 -29
- data/db/migrate/20170306154901_add_missing_outstanding_account.xml +0 -4
- data/db/migrate/20170308232701_add_fr_pcga_profit_and_loss.xml +0 -4
- data/db/migrate/20170312112401_add_fr_pcga_balance_sheet.xml +0 -4
- data/db/migrate/20170312172301_add_fr_pcg82_balance_sheet.xml +0 -5
- data/db/migrate/20170320073301_add_journal_entry_sheet.xml +0 -8
- data/db/migrate/20170320144338_add_sundry_debtors_and_creditors_usage.xml +0 -4
- data/db/migrate/20170322223101_add_loan_registry.xml +0 -4
- data/db/migrate/20170324084701_add_fixed_asset_sheet.xml +0 -4
- data/db/migrate/20170328144501_add_pnt_loan_accounts.xml +0 -5
- data/db/migrate/20170328165900_update_foliar_spray_product_nature.xml +0 -4
- data/db/migrate/20170328170000_add_indicator.xml +0 -4
- data/db/migrate/20170328170100_update_product_nature_seedling.xml +0 -6
- data/db/migrate/20170328170200_add_indicators.xml +0 -4
- data/db/migrate/20170328170300_add_indicators2.xml +0 -4
- data/db/migrate/20170328170400_update_seedling_product_natures.xml +0 -4
- data/db/migrate/20170405135101_add_account_journal_entry_sheet.xml +0 -4
- data/db/migrate/20170407214236_add_portuguese_account_config.xml +0 -4
- data/db/migrate/20170524094443_add_urtica_variety.xml +0 -5
- data/db/migrate/20170614130921_add_varieties.xml +0 -117
- data/db/migrate/20170627075545_add_varieties2.xml +0 -37
- data/db/migrate/20170627081533_add_pending_deposit_payments_account_number_for_pt_accounting_system.xml +0 -4
- data/db/migrate/20170718131724_add_issue_natures.xml +0 -54
- data/db/migrate/20170803164344_add_procedure_nature_and_category.xml +0 -5
- data/db/migrate/20170904223101_add_cultivable_zone_registry.xml +0 -4
- data/db/migrate/20170914083358_add_new_product_nature_variants.xml +0 -14
- data/db/migrate/20170927144852_add_kiwi_varieties.xml +0 -7
- data/db/migrate/20171106085357_update_account_numbers.xml +0 -431
- data/db/migrate/20171212081801_add_fiscal_positions.xml +0 -12
- data/db/migrate/20180408190101_add_new_plant_variants.xml +0 -7
- data/db/migrate/20180409130101_add_common_crop.xml +0 -4
- data/db/migrate/20180418085027_add-hour-counter-indicator.xml +0 -9
- data/db/migrate/20180709134310_add_centralizing_field_to_accounts.xml +0 -22
- data/db/migrate/20180711093131_review_all_accounts_number_and_fallbacks.xml +0 -431
- data/db/migrate/20180806080646_edit_centralizing_field_accounts.xml +0 -17
- data/db/migrate/20180814184001_add_missing_categories.xml +0 -12
- data/db/migrate/20180907160001_edit_accounts_to_unlock_first_run.xml +0 -21
- data/db/migrate/20181004220301_add_journal_ledger.xml +0 -4
- data/db/migrate/20181205162401_add_intra_vat.xml +0 -6
- data/db/migrate/20181213153405_fix_accounting_systems.xml +0 -7
- data/db/migrate/20181217155149_fiscal_position_refers_to_accounting_system.xml +0 -10
- data/db/migrate/20181217173101_fiscal_position_reference_typo.xml +0 -4
- data/db/migrate/20190315154040_add_suspense_account.xml +0 -4
- data/db/migrate/20190326110849_add_asset_fixable_to_product_nature_categories.xml +0 -25
- data/db/migrate/20190326135443_change_product_nature_category_cultivable_zone_into_land.xml +0 -21
- data/db/migrate/20190329133808_change_land_fixed_assets_account_usage.xml +0 -7
- data/db/migrate/20190405120711_delete_land_sales_account_and_assign_land_parcels_sell_revenues_to_land.xml +0 -5
- data/db/migrate/20190412071057_add_new_fixed_assets_andn_depreciable_accounts.xml +0 -22
- data/db/migrate/20190509092804_add_account_exceptional_depreciations_imputations_expenses_for_fixed_assets.xml +0 -4
- data/db/migrate/20190514084753_add_approved_input_volume.xml +0 -9
- data/db/migrate/20190520072403_add_new_accounts.xml +0 -58
- data/db/migrate/20190521170601_add_missing_taxes.xml +0 -7
- data/db/migrate/20190611101014_change_deductible_vat_account.xml +0 -5
- data/db/migrate/20190620092151_fix_conflicts_in_new_accounts.xml +0 -6
- data/db/migrate/20190625152636_change_mixture_seed_product_nature_variant.xml +0 -4
- data/db/migrate/20190718130243_remove_services_expenses.xml +0 -5
- data/db/migrate/20190801142431_remove_accounts_from_pcg82.xml +0 -5
- data/db/migrate/20190807125202_add_nature_to_product_natures.xml +0 -326
- data/db/migrate/20190823091727_fix-cubic-meter-per-hectare-symbol.xml +0 -5
- data/db/migrate/20190909150402_add_staff_supply_stock_account.xml +0 -4
- data/db/migrate/20190913102036_add_caliber_indicator.xml +0 -4
- data/db/migrate/20190917161215_add_missing_mass_area_density_units.xml +0 -21
- data/db/migrate/20190917161216_update_quintal_symbol.xml +0 -4
- data/db/migrate/20190917161217_adds_more_info_to_units.xml +0 -133
- data/db/migrate/20190918074757_add_new_accounts.xml +0 -8
- data/db/migrate/20191001122750_add_accounts_fixed_assets_related.xml +0 -10
- data/db/migrate/20191016152118_add_missing_document_templates.xml +0 -6
- data/db/migrate/20191028175001_add_short_balance_sheet.xml +0 -4
- data/db/migrate/20191029131921_add_vine_equipments.xml +0 -117
- data/db/migrate/20191112132413_remove_roller_from_product_natures.xml +0 -5
- data/db/migrate/20191113134626_add_nature_to_new_product_natures.xml +0 -11
- data/db/migrate/20191125133327_add_missing_units_and_indicators.xml +0 -5
- data/db/migrate/20200107095554_add_signed_field_to_document_nature.xml +0 -9
- data/db/migrate/20200305160358_add_varieties_for_phytosanitary.xml +0 -11
- data/db/migrate/20200421123503_add_type_to_categories_and_variants.xml +0 -1136
- data/db/migrate/20200514092205_add_liter_per_hectoliter_unit.xml +0 -4
- data/db/migrate/20200722091859_triticale_derivative_of.xml +0 -5
- data/db/reference.xml +0 -12966
- data/lib/onoma/models/certification.rb +0 -4
- data/lib/onoma/models/certification_label.rb +0 -4
- data/lib/onoma/models/land.rb +0 -4
data/config/locales/por.yml
CHANGED
@@ -701,22 +701,6 @@ por:
|
|
701
701
|
name: "Estados vida animal"
|
702
702
|
cation_exchange_capacity_analysis_methods:
|
703
703
|
name: "Métodos de análise de capacidade de troca catiônica"
|
704
|
-
certification_labels:
|
705
|
-
items:
|
706
|
-
bio: "Bio"
|
707
|
-
name: "As etiquetas de certificação"
|
708
|
-
certifications:
|
709
|
-
items:
|
710
|
-
bordeaux_claret: "Bordeaux clarete"
|
711
|
-
bordeaux_haut_benauge_avec_sucres: "Bordeaux Haut-Benauge sucres avec"
|
712
|
-
bordeaux_rose: "Bordeaux Rose"
|
713
|
-
bordeaux_superieur_blanc: "Bordeaux blanc supérieur"
|
714
|
-
bordeaux_superieur_rouge: "Bordeaux Supérieur rouge"
|
715
|
-
cognac: "Conhaque"
|
716
|
-
eau_de_vie_des_charentes: "Eau de vie des Charentes"
|
717
|
-
name: "Certificações"
|
718
|
-
property_natures:
|
719
|
-
land: "Terra"
|
720
704
|
chemical_classifications:
|
721
705
|
items:
|
722
706
|
dsd_corrosive: "Corrosivo"
|
@@ -2187,11 +2171,6 @@ por:
|
|
2187
2171
|
cause: "Causa"
|
2188
2172
|
target: "Alvo"
|
2189
2173
|
treatments: "Tratamentos"
|
2190
|
-
lands:
|
2191
|
-
items:
|
2192
|
-
bordeaux_haut_benauge: "Bordeaux Benauge haut"
|
2193
|
-
bordeaux_superieur: "Bordeaux Superieur"
|
2194
|
-
cognac: "Conhaque"
|
2195
2174
|
languages:
|
2196
2175
|
items:
|
2197
2176
|
afr: "Afrikaans"
|
data/config/locales/spa.yml
CHANGED
@@ -697,29 +697,6 @@ spa:
|
|
697
697
|
name: "Estados vida animal"
|
698
698
|
cation_exchange_capacity_analysis_methods:
|
699
699
|
name: "Métodos de análisis de capacidad de intercambio catiónico"
|
700
|
-
certification_labels:
|
701
|
-
items:
|
702
|
-
ig: "YO G"
|
703
|
-
name: "Las etiquetas de certificación"
|
704
|
-
certifications:
|
705
|
-
items:
|
706
|
-
bordeaux_blanc: "Blanc Burdeos"
|
707
|
-
bordeaux_blanc_avec_sucres: "Burdeos blanc avec sucres"
|
708
|
-
bordeaux_clairet: "Clairet Burdeos"
|
709
|
-
bordeaux_claret: "Claret Burdeos"
|
710
|
-
bordeaux_haut_benauge: "Burdeos Haut-Benauge"
|
711
|
-
bordeaux_haut_benauge_avec_sucres: "Burdeos Haut-Benauge sucres avec"
|
712
|
-
bordeaux_rose: "Rosa Burdeos"
|
713
|
-
bordeaux_rouge: "Rouge Burdeos"
|
714
|
-
bordeaux_superieur_blanc: "Burdeos blanc Superior"
|
715
|
-
bordeaux_superieur_rouge: "Burdeos rouge Superior"
|
716
|
-
cognac: "Coñac"
|
717
|
-
eau_de_vie_de_cognac: "Eau de vie de coñac"
|
718
|
-
eau_de_vie_des_charentes: "Eau de vie des Charentes"
|
719
|
-
name: "Certificaciones"
|
720
|
-
property_natures:
|
721
|
-
labels: "Etiquetas"
|
722
|
-
land: "Tierra"
|
723
700
|
chemical_classifications:
|
724
701
|
items:
|
725
702
|
dsd_corrosive: "Corrosivo"
|
@@ -2349,13 +2326,6 @@ spa:
|
|
2349
2326
|
cause: "Porque"
|
2350
2327
|
target: "Objetivo"
|
2351
2328
|
treatments: "Tratos"
|
2352
|
-
lands:
|
2353
|
-
items:
|
2354
|
-
bordeaux: "Burdeos"
|
2355
|
-
bordeaux_haut_benauge: "Burdeos Benauge haut"
|
2356
|
-
bordeaux_superieur: "Superieur Burdeos"
|
2357
|
-
cognac: "Coñac"
|
2358
|
-
name: "Tierras"
|
2359
2329
|
languages:
|
2360
2330
|
items:
|
2361
2331
|
afr: "Afrikaans"
|
data/lib/onoma.rb
CHANGED
@@ -12,7 +12,7 @@ require 'yaml'
|
|
12
12
|
require 'zeitwerk'
|
13
13
|
|
14
14
|
loader = Zeitwerk::Loader.for_gem
|
15
|
-
loader.collapse(
|
15
|
+
loader.collapse("#{__dir__}/onoma/models")
|
16
16
|
loader.setup
|
17
17
|
|
18
18
|
module Onoma
|
@@ -62,6 +62,7 @@ module Onoma
|
|
62
62
|
# Returns version of DB
|
63
63
|
def reference_version
|
64
64
|
return 0 unless reference_path.exist?
|
65
|
+
|
65
66
|
reference_document.root['version'].to_i
|
66
67
|
end
|
67
68
|
|
@@ -116,6 +117,7 @@ module Onoma
|
|
116
117
|
elsif args.size == 1
|
117
118
|
return nomenclature.find(args.shift) if nomenclature
|
118
119
|
end
|
120
|
+
|
119
121
|
nil
|
120
122
|
end
|
121
123
|
|
data/lib/onoma/item.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:disable Style/MissingRespondToMissing
|
1
2
|
require 'set'
|
2
3
|
|
3
4
|
module Onoma
|
@@ -48,6 +49,7 @@ module Onoma
|
|
48
49
|
if item.parents.any? { |p| self == p } || self == item
|
49
50
|
raise 'Circular dependency. Item can be parent of itself.'
|
50
51
|
end
|
52
|
+
|
51
53
|
@parent = item
|
52
54
|
@parent_name = @parent.name.to_s
|
53
55
|
end
|
@@ -78,10 +80,12 @@ module Onoma
|
|
78
80
|
|
79
81
|
def parent
|
80
82
|
return @parent if @parent
|
83
|
+
|
81
84
|
@parent = find_parent
|
82
85
|
@parent.add_child(self) if @parent
|
83
86
|
@parent
|
84
87
|
end
|
88
|
+
|
85
89
|
alias fetch_parent parent
|
86
90
|
|
87
91
|
def find_parent
|
@@ -93,9 +97,11 @@ module Onoma
|
|
93
97
|
a = self_and_parents.reverse
|
94
98
|
b = other_item.self_and_parents.reverse
|
95
99
|
return nil if a.first != b.first
|
100
|
+
|
96
101
|
common_lineage = 0
|
97
102
|
a.size.times do |index|
|
98
103
|
break if a[index].nil? || b[index].nil? || a[index] != b[index]
|
104
|
+
|
99
105
|
common_lineage += 1
|
100
106
|
end
|
101
107
|
a.size + b.size - 2 * common_lineage
|
@@ -103,6 +109,7 @@ module Onoma
|
|
103
109
|
|
104
110
|
def original_nomenclature_name
|
105
111
|
return parent.name.to_sym unless root?
|
112
|
+
|
106
113
|
nil
|
107
114
|
end
|
108
115
|
|
@@ -118,16 +125,14 @@ module Onoma
|
|
118
125
|
list
|
119
126
|
end
|
120
127
|
end
|
128
|
+
elsif options[:recursively].is_a?(FalseClass)
|
129
|
+
nomenclature.list.select do |item|
|
130
|
+
@left < item.left && item.right < @right && item.depth == @depth + 1
|
131
|
+
end
|
121
132
|
else
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
end
|
126
|
-
else
|
127
|
-
# @children ||=
|
128
|
-
nomenclature.list.select do |item|
|
129
|
-
@left < item.left && item.right < @right
|
130
|
-
end
|
133
|
+
# @children ||=
|
134
|
+
nomenclature.list.select do |item|
|
135
|
+
@left < item.left && item.right < @right
|
131
136
|
end
|
132
137
|
end
|
133
138
|
end
|
@@ -152,6 +157,7 @@ module Onoma
|
|
152
157
|
def rise(&block)
|
153
158
|
result = yield(self)
|
154
159
|
return result if result
|
160
|
+
|
155
161
|
parent ? parent.rise(&block) : nil
|
156
162
|
end
|
157
163
|
|
@@ -196,6 +202,7 @@ module Onoma
|
|
196
202
|
end
|
197
203
|
I18n.t(root, options.merge(default: [*defaults.map(&:to_sym), "items.#{Onoma.escape_key(name)}".to_sym, "enumerize.#{Onoma.escape_key(nomenclature.name)}.#{Onoma.escape_key(name)}".to_sym, "labels.#{Onoma.escape_key(name)}".to_sym, name.humanize]))
|
198
204
|
end
|
205
|
+
|
199
206
|
alias humanize human_name
|
200
207
|
alias localize human_name
|
201
208
|
alias l localize
|
@@ -266,6 +273,7 @@ module Onoma
|
|
266
273
|
# Returns property value
|
267
274
|
def property(name)
|
268
275
|
return @name.to_sym if name == :name
|
276
|
+
|
269
277
|
property = @nomenclature.properties[name]
|
270
278
|
value = @attributes[name]
|
271
279
|
if property
|
@@ -291,11 +299,12 @@ module Onoma
|
|
291
299
|
unless target_nomenclature
|
292
300
|
raise "Cannot find nomenclature: for #{property(name).inspect}"
|
293
301
|
end
|
302
|
+
|
294
303
|
return target_nomenclature.list.collect do |i|
|
295
304
|
[i.human_name, i.name]
|
296
305
|
end
|
297
306
|
else
|
298
|
-
raise StandardError
|
307
|
+
raise StandardError.new('Cannot call selection for a non-list property')
|
299
308
|
end
|
300
309
|
end
|
301
310
|
|
@@ -307,11 +316,13 @@ module Onoma
|
|
307
316
|
# Returns property descriptor
|
308
317
|
def method_missing(method_name, *args)
|
309
318
|
return property(method_name) if has_property?(method_name)
|
319
|
+
|
310
320
|
super
|
311
321
|
end
|
312
322
|
|
313
323
|
def set(name, value)
|
314
324
|
raise "Invalid property: #{name.inspect}" if %i[name parent].include?(name.to_sym)
|
325
|
+
|
315
326
|
# # TODO: check format
|
316
327
|
# if property = nomenclature.properties[name]
|
317
328
|
# value ||= [] if property.list?
|
@@ -325,16 +336,18 @@ module Onoma
|
|
325
336
|
|
326
337
|
private
|
327
338
|
|
328
|
-
|
329
|
-
|
330
|
-
|
339
|
+
def cast_property(name, value)
|
340
|
+
@nomenclature.cast_property(name, value)
|
341
|
+
end
|
331
342
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
343
|
+
def item_for_comparison(other)
|
344
|
+
item = nomenclature[other.is_a?(Item) ? other.name : other]
|
345
|
+
unless item
|
346
|
+
raise StandardError.new("Invalid operand to compare: #{other.inspect} not in #{nomenclature.name}")
|
347
|
+
end
|
348
|
+
|
349
|
+
item
|
336
350
|
end
|
337
|
-
item
|
338
|
-
end
|
339
351
|
end
|
340
352
|
end
|
353
|
+
# rubocop:enable Style/MissingRespondToMissing
|
@@ -7,11 +7,11 @@ module Onoma
|
|
7
7
|
name = element['item'].split('#')
|
8
8
|
@nomenclature = name.first
|
9
9
|
@name = name.second
|
10
|
-
@changes = element.attributes
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
@changes = element.attributes
|
11
|
+
.delete_if { |k, _v| %w[item].include?(k) }
|
12
|
+
.each_with_object({}) do |(k, v), h|
|
13
|
+
h[k.to_sym] = (v.to_s.blank? ? nil : v.to_s)
|
14
|
+
end
|
15
15
|
end
|
16
16
|
|
17
17
|
def new_name?
|
@@ -5,14 +5,13 @@ module Onoma
|
|
5
5
|
attr_reader :nomenclature, :name, :options
|
6
6
|
def initialize(element)
|
7
7
|
raise 'Need item attribute' unless element['item']
|
8
|
+
|
8
9
|
name = element['item'].split('#')
|
9
10
|
@nomenclature = name.first
|
10
11
|
@name = name.second
|
11
|
-
@options = element.attributes
|
12
|
-
|
13
|
-
|
14
|
-
h[k.to_sym] = v.to_s
|
15
|
-
end
|
12
|
+
@options = element.attributes
|
13
|
+
.delete_if { |k, _v| k =~ /name(:[a-z]{3})?/ || %w[item parent nomenclature].include?(k) }
|
14
|
+
.each_with_object({}) { |(k, v), h| h[k.to_sym] = v.to_s }
|
16
15
|
@options[:parent] = element['parent'].to_sym if element.key?('parent')
|
17
16
|
end
|
18
17
|
|
@@ -5,8 +5,15 @@ module Onoma
|
|
5
5
|
attr_reader :nomenclature, :options
|
6
6
|
|
7
7
|
def initialize(element)
|
8
|
-
@nomenclature = element.key?('nomenclature')
|
8
|
+
@nomenclature = if element.key?('nomenclature')
|
9
|
+
element['nomenclature'].to_s
|
10
|
+
elsif element.key?('name')
|
11
|
+
element['name'].to_s
|
12
|
+
else
|
13
|
+
nil
|
14
|
+
end
|
9
15
|
raise 'No given name' unless @nomenclature
|
16
|
+
|
10
17
|
@options = {}
|
11
18
|
notions = element.attr('notions').to_s.split(/\s*\,\s*/).map(&:to_sym)
|
12
19
|
@options[:notions] = notions if notions.any?
|
@@ -9,8 +9,9 @@ module Onoma
|
|
9
9
|
@name = name.second
|
10
10
|
@type = element['type'].to_sym
|
11
11
|
unless Onoma::PROPERTY_TYPES.include?(@type)
|
12
|
-
raise ArgumentError
|
12
|
+
raise ArgumentError.new("Property #{name} type is unknown: #{@type.inspect}")
|
13
13
|
end
|
14
|
+
|
14
15
|
@options = {}
|
15
16
|
if element.has_attribute?('fallbacks')
|
16
17
|
@options[:fallbacks] = element.attr('fallbacks').to_s.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym)
|
data/lib/onoma/migration/base.rb
CHANGED
@@ -38,6 +38,7 @@ module Onoma
|
|
38
38
|
def hash_to_yaml(hash, depth = nil)
|
39
39
|
code = hash.sort_by { |a| a[0].to_s.tr('_', ' ').strip }.map do |k, v|
|
40
40
|
next unless v
|
41
|
+
|
41
42
|
pair_to_yaml(k, v)
|
42
43
|
end.join("\n")
|
43
44
|
code = "\n" + code.indent(depth).gsub(/^\s+$/, '') unless depth.nil?
|
@@ -54,7 +55,7 @@ module Onoma
|
|
54
55
|
elsif value.is_a?(Numeric)
|
55
56
|
value.to_s
|
56
57
|
else
|
57
|
-
v = value.to_s.gsub(
|
58
|
+
v = value.to_s.gsub('\\u00A0', '\\_')
|
58
59
|
value =~ /\n/ ? "|\n" + v.strip.indent : '"' + v + '"'
|
59
60
|
end
|
60
61
|
end
|
data/lib/onoma/nomenclature.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:disable Style/MissingRespondToMissing
|
1
2
|
module Onoma
|
2
3
|
# This class represents a nomenclature
|
3
4
|
class Nomenclature
|
@@ -67,7 +68,18 @@ module Onoma
|
|
67
68
|
properties = @properties.values
|
68
69
|
CSV.open(file, 'wb') do |csv|
|
69
70
|
csv << [:name] + properties.map do |p|
|
70
|
-
suffix =
|
71
|
+
suffix = if p.decimal?
|
72
|
+
' D'
|
73
|
+
elsif p.integer?
|
74
|
+
' I'
|
75
|
+
elsif p.boolean?
|
76
|
+
' B'
|
77
|
+
elsif p.item?
|
78
|
+
" R(#{p.choices_nomenclature})"
|
79
|
+
else
|
80
|
+
''
|
81
|
+
end
|
82
|
+
|
71
83
|
"#{p.name}#{suffix}"
|
72
84
|
end
|
73
85
|
@items.values.each do |i|
|
@@ -95,6 +107,7 @@ module Onoma
|
|
95
107
|
parent = attributes[:parent] || (element.key?('parent') ? element['parent'] : nil)
|
96
108
|
attributes = element.attributes.each_with_object(HashWithIndifferentAccess.new) do |(k, v), h|
|
97
109
|
next if %w[name parent].include?(k)
|
110
|
+
|
98
111
|
h[k] = cast_property(k, v.to_s)
|
99
112
|
end
|
100
113
|
attributes[:parent] = parent if parent
|
@@ -132,12 +145,13 @@ module Onoma
|
|
132
145
|
elsif element.has_attribute?('nomenclature')
|
133
146
|
options[:choices] = element.attr('nomenclature').to_s.strip.to_sym
|
134
147
|
else
|
135
|
-
raise MissingChoices
|
148
|
+
raise MissingChoices.new("[#{@name}] Property #{name} must have nomenclature as choices")
|
136
149
|
end
|
137
150
|
end
|
138
151
|
unless Onoma::PROPERTY_TYPES.include?(type)
|
139
|
-
raise ArgumentError
|
152
|
+
raise ArgumentError.new("Property #{name} type is unknown: #{type.inspect}")
|
140
153
|
end
|
154
|
+
|
141
155
|
add_property(name, type, options)
|
142
156
|
end
|
143
157
|
|
@@ -147,6 +161,7 @@ module Onoma
|
|
147
161
|
if @items[i.name]
|
148
162
|
raise "Item #{i.name} is already defined in nomenclature #{@name}"
|
149
163
|
end
|
164
|
+
|
150
165
|
@items[i.name] = i
|
151
166
|
@roots << i unless i.parent?
|
152
167
|
i.rebuild_tree! unless options[:rebuild].is_a?(FalseClass)
|
@@ -161,6 +176,7 @@ module Onoma
|
|
161
176
|
new_name = changes[:name]
|
162
177
|
changes.each do |k, v|
|
163
178
|
next if %i[parent name].include? k
|
179
|
+
|
164
180
|
i.set(k, v)
|
165
181
|
end
|
166
182
|
if has_parent
|
@@ -176,6 +192,7 @@ module Onoma
|
|
176
192
|
if @items[new_name]
|
177
193
|
raise "Item #{new_name} is already defined in nomenclature #{@name}. Use merging instead."
|
178
194
|
end
|
195
|
+
|
179
196
|
i = find!(name)
|
180
197
|
i.children.each do |child|
|
181
198
|
child.parent_name = new_name
|
@@ -191,6 +208,7 @@ module Onoma
|
|
191
208
|
def cascade_item_renaming(name, new_name)
|
192
209
|
@set.references.each do |reference|
|
193
210
|
next unless reference.foreign_nomenclature == self
|
211
|
+
|
194
212
|
p = reference.property
|
195
213
|
if p.list?
|
196
214
|
reference.nomenclature.find_each do |item|
|
@@ -232,6 +250,7 @@ module Onoma
|
|
232
250
|
if @properties[p.name]
|
233
251
|
raise "Property #{p.name} is already defined in nomenclature #{@name}"
|
234
252
|
end
|
253
|
+
|
235
254
|
@properties[p.name] = p
|
236
255
|
@references = nil
|
237
256
|
p
|
@@ -245,11 +264,11 @@ module Onoma
|
|
245
264
|
# Check properties
|
246
265
|
@properties.values.each do |property|
|
247
266
|
if property.choices_nomenclature && !property.inline_choices? && !Onoma[property.choices_nomenclature.to_s]
|
248
|
-
raise InvalidPropertyNature
|
267
|
+
raise InvalidPropertyNature.new("[#{name}] #{property.name} nomenclature property must refer to an existing nomenclature. Got #{property.choices_nomenclature.inspect}. Expecting: #{Onoma.names.inspect}")
|
249
268
|
end
|
250
269
|
next unless property.type == :choice && property.default
|
251
270
|
unless property.choices.include?(property.default)
|
252
|
-
raise InvalidPropertyNature
|
271
|
+
raise InvalidPropertyNature.new("The default choice #{property.default.inspect} is invalid (in #{name}##{property.name}). Pick one from #{property.choices.sort.inspect}.")
|
253
272
|
end
|
254
273
|
end
|
255
274
|
|
@@ -261,16 +280,16 @@ module Onoma
|
|
261
280
|
# Cleans for parametric reference
|
262
281
|
name = item.property(property.name).to_s.split(/\(/).first.to_sym
|
263
282
|
unless choices.include?(name)
|
264
|
-
raise InvalidProperty
|
283
|
+
raise InvalidProperty.new("The given choice #{name.inspect} is invalid (in #{self.name}##{item.name}). Pick one from #{choices.sort.inspect}.")
|
265
284
|
end
|
266
285
|
elsif item.property(property.name) && property.type == :list && property.choices_nomenclature
|
267
|
-
|
286
|
+
(item.property(property.name) || []).each { |name|
|
268
287
|
# Cleans for parametric reference
|
269
288
|
name = name.to_s.split(/\(/).first.to_sym
|
270
289
|
unless choices.include?(name)
|
271
|
-
raise InvalidProperty
|
290
|
+
raise InvalidProperty.new("The given choice #{name.inspect} is invalid (in #{self.name}##{item.name}). Pick one from #{choices.sort.inspect}.")
|
272
291
|
end
|
273
|
-
|
292
|
+
}
|
274
293
|
end
|
275
294
|
end
|
276
295
|
end
|
@@ -300,6 +319,7 @@ module Onoma
|
|
300
319
|
def human_name(options = {})
|
301
320
|
I18n.t("nomenclatures.#{Onoma.escape_key(name)}.name", options.merge(default: ["labels.#{Onoma.escape_key(name)}".to_sym, name.to_s.humanize]))
|
302
321
|
end
|
322
|
+
|
303
323
|
alias humanize human_name
|
304
324
|
|
305
325
|
def new_boundaries(count = 2)
|
@@ -328,6 +348,7 @@ module Onoma
|
|
328
348
|
@items.keys.sort
|
329
349
|
end
|
330
350
|
end
|
351
|
+
|
331
352
|
alias all to_a
|
332
353
|
|
333
354
|
def <=>(other)
|
@@ -349,24 +370,21 @@ module Onoma
|
|
349
370
|
# Returns a list for select as an array of pair (array)
|
350
371
|
def selection(item_name = nil)
|
351
372
|
items = (item_name ? find!(item_name).self_and_children : @items.values)
|
352
|
-
items.
|
353
|
-
|
354
|
-
end.sort do |a, b|
|
355
|
-
a.first.lower_ascii <=> b.first.lower_ascii
|
356
|
-
end
|
373
|
+
items.map { |item| [item.human_name, item.name.to_s] }
|
374
|
+
.sort { |a, b| a.first.lower_ascii <=> b.first.lower_ascii }
|
357
375
|
end
|
358
376
|
|
359
377
|
# Returns a list for select as an array of pair (hash)
|
360
378
|
def selection_hash(item_name = nil)
|
361
379
|
items = (item_name ? find!(item_name).self_and_children : @items.values)
|
362
|
-
items.
|
363
|
-
|
364
|
-
end.sort { |a, b| a[:label].lower_ascii <=> b[:label].lower_ascii }
|
380
|
+
items.map { |item| { label: item.human_name, value: item.name } }
|
381
|
+
.sort { |a, b| a[:label].lower_ascii <=> b[:label].lower_ascii }
|
365
382
|
end
|
366
383
|
|
367
384
|
# Returns a list for select, without specified items
|
368
385
|
def select_without(already_imported)
|
369
386
|
ActiveSupport::Deprecation.warn 'Onoma::Nomenclature#select_without method is deprecated. Please use Onoma::Nomenclature#without method instead.'
|
387
|
+
|
370
388
|
select_options = @items.values.collect do |item|
|
371
389
|
[item.human_name, item.name.to_s] unless already_imported[item.name.to_s]
|
372
390
|
end
|
@@ -395,13 +413,15 @@ module Onoma
|
|
395
413
|
def find(item_name)
|
396
414
|
@items[item_name]
|
397
415
|
end
|
416
|
+
|
398
417
|
alias item find
|
399
418
|
|
400
419
|
# Return the Item for the given name. Raises Onoma::ItemNotFound if no item
|
401
420
|
# found in nomenclature
|
402
421
|
def find!(item_name)
|
403
422
|
i = find(item_name)
|
404
|
-
raise ItemNotFound
|
423
|
+
raise ItemNotFound.new("Cannot find item #{item_name.inspect} in #{name}") unless i
|
424
|
+
|
405
425
|
i
|
406
426
|
end
|
407
427
|
|
@@ -412,6 +432,7 @@ module Onoma
|
|
412
432
|
def exists?(item)
|
413
433
|
@items[item.respond_to?(:name) ? item.name : item].present?
|
414
434
|
end
|
435
|
+
|
415
436
|
alias include? exists?
|
416
437
|
|
417
438
|
def property(property_name)
|
@@ -439,8 +460,8 @@ module Onoma
|
|
439
460
|
value.each do |val|
|
440
461
|
if val.is_a?(Onoma::Item)
|
441
462
|
one_found = true if item_value == val.name.to_sym
|
442
|
-
|
443
|
-
one_found = true
|
463
|
+
elsif item_value == val
|
464
|
+
one_found = true
|
444
465
|
end
|
445
466
|
end
|
446
467
|
valid = false unless one_found
|
@@ -464,6 +485,7 @@ module Onoma
|
|
464
485
|
def find_by(properties)
|
465
486
|
items = where(properties)
|
466
487
|
return nil unless items.any?
|
488
|
+
|
467
489
|
items.first
|
468
490
|
end
|
469
491
|
|
@@ -475,6 +497,7 @@ module Onoma
|
|
475
497
|
items << item if item.property(property_name) == searched_item.name
|
476
498
|
end
|
477
499
|
break if items.any?
|
500
|
+
|
478
501
|
searched_item = searched_item.parent
|
479
502
|
end while searched_item
|
480
503
|
items
|
@@ -487,6 +510,7 @@ module Onoma
|
|
487
510
|
|
488
511
|
def cast_options(options)
|
489
512
|
return {} if options.nil?
|
513
|
+
|
490
514
|
options.each_with_object({}) do |(k, v), h|
|
491
515
|
h[k.to_sym] = if properties[k]
|
492
516
|
cast_property(k, v.to_s)
|
@@ -501,13 +525,20 @@ module Onoma
|
|
501
525
|
if property = properties[name]
|
502
526
|
if property.type == :choice || property.type == :item
|
503
527
|
if value =~ /\,/
|
504
|
-
raise InvalidPropertyNature
|
528
|
+
raise InvalidPropertyNature.new('A property nature of choice type cannot contain commas')
|
505
529
|
end
|
530
|
+
|
506
531
|
value = value.strip.to_sym
|
507
532
|
elsif property.list?
|
508
533
|
value = value.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym)
|
509
534
|
elsif property.type == :boolean
|
510
|
-
value =
|
535
|
+
value = if value == 'true'
|
536
|
+
true
|
537
|
+
elsif value == 'false'
|
538
|
+
false
|
539
|
+
else
|
540
|
+
nil
|
541
|
+
end
|
511
542
|
elsif property.type == :decimal
|
512
543
|
value = BigDecimal(value)
|
513
544
|
elsif property.type == :integer
|
@@ -516,14 +547,16 @@ module Onoma
|
|
516
547
|
value = (value.blank? ? nil : Date.parse(value))
|
517
548
|
elsif property.type == :symbol
|
518
549
|
unless value =~ /\A\w+\z/
|
519
|
-
raise InvalidPropertyNature
|
550
|
+
raise InvalidPropertyNature.new("A property '#{name}' must contains a symbol. /[a-z0-9_]/ accepted. No spaces. Got #{value.inspect}")
|
520
551
|
end
|
552
|
+
|
521
553
|
value = value.to_sym
|
522
554
|
end
|
523
555
|
elsif !%w[name parent aliases].include?(name.to_s)
|
524
|
-
raise ArgumentError
|
556
|
+
raise ArgumentError.new("Undefined property '#{name}' in #{@name}")
|
525
557
|
end
|
526
558
|
value
|
527
559
|
end
|
528
560
|
end
|
529
561
|
end
|
562
|
+
# rubocop:enable Style/MissingRespondToMissing
|