foobara 0.5.10 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +22 -0
- data/lib/foobara/all.rb +4 -2
- data/projects/command/src/command_pattern_implementation/concerns/command_data.rb +3 -3
- data/projects/command/src/command_pattern_implementation/concerns/domain_mappers.rb +2 -2
- data/projects/command/src/command_pattern_implementation/concerns/errors.rb +27 -27
- data/projects/command/src/command_pattern_implementation/concerns/errors_type.rb +7 -11
- data/projects/command/src/command_pattern_implementation/concerns/inputs.rb +4 -24
- data/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb +9 -14
- data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +7 -20
- data/projects/command/src/command_pattern_implementation/concerns/runtime.rb +3 -48
- data/projects/command/src/command_pattern_implementation/concerns/subcommands.rb +5 -5
- data/projects/command/src/command_pattern_implementation.rb +0 -1
- data/projects/command_connectors/lib/foobara/command_connectors.rb +1 -1
- data/projects/command_connectors/src/command_connector/concerns/desugarizers.rb +5 -5
- data/projects/command_connectors/src/command_connector/concerns/reflection.rb +63 -17
- data/projects/command_connectors/src/command_connector/request.rb +26 -10
- data/projects/command_connectors/src/command_connector/response.rb +2 -0
- data/projects/command_connectors/src/command_connector.rb +62 -58
- data/projects/command_connectors/src/command_registry/exposed_command.rb +7 -2
- data/projects/command_connectors/src/command_registry.rb +24 -18
- data/projects/command_connectors/src/desugarizer.rb +2 -2
- data/projects/command_connectors/src/desugarizers/attributes.rb +8 -8
- data/projects/command_connectors/src/desugarizers/auth.rb +1 -1
- data/projects/command_connectors/src/desugarizers/set_inputs.rb +3 -3
- data/projects/command_connectors/src/desugarizers/symbols_to_true.rb +2 -2
- data/projects/command_connectors/src/request_mutator.rb +6 -6
- data/projects/command_connectors/src/response_mutator.rb +6 -6
- data/projects/command_connectors/src/transformed_command.rb +39 -36
- data/projects/command_connectors/src/transformers/auth_errors_transformer.rb +2 -2
- data/projects/command_connectors/src/transformers/entity_to_primary_key_inputs_transformer.rb +2 -2
- data/projects/command_connectors/src/transformers/load_delegated_attributes_entities_pre_commit_transformer.rb +1 -1
- data/projects/domain_mapper/src/domain_mapper.rb +4 -4
- data/projects/domain_mapper/src/domain_mapper_lookups.rb +3 -3
- data/projects/entities/projects/detached_entity/lib/foobara/detached_entity.rb +1 -1
- data/projects/entities/projects/detached_entity/src/concerns/associations.rb +18 -18
- data/projects/entities/projects/detached_entity/src/concerns/initialization.rb +2 -2
- data/projects/entities/projects/detached_entity/src/concerns/primary_key.rb +4 -4
- data/projects/entities/projects/detached_entity/src/concerns/types.rb +2 -2
- data/projects/entities/projects/detached_entity/src/detached_entity_type.rb +4 -4
- data/projects/entities/projects/detached_entity/src/extensions/builtin_types/detached_entity/casters/primary_key.rb +1 -1
- data/projects/entities/projects/detached_entity/src/extensions/builtin_types/detached_entity/validators/model_instance_is_valid.rb +2 -2
- data/projects/entities/projects/detached_entity/src/extensions/type_declarations/handlers/registered_type_declaration/validate_primary_key_present.rb +30 -0
- data/projects/entities/projects/detached_entity/src/remove_sensitive_values_transformer_extensions.rb +2 -2
- data/projects/entities/projects/entity/lib/foobara/entity.rb +1 -1
- data/projects/entities/projects/entity/src/concerns/attributes.rb +6 -6
- data/projects/entities/projects/entity/src/concerns/callbacks.rb +1 -1
- data/projects/entities/projects/entity/src/concerns/initialization.rb +8 -8
- data/projects/entities/projects/entity/src/concerns/mutations.rb +4 -4
- data/projects/entities/projects/entity/src/concerns/persistence.rb +3 -3
- data/projects/entities/projects/entity/src/concerns/queries.rb +7 -7
- data/projects/entities/projects/entity/src/extensions/domain/domain_module_extension.rb +4 -4
- data/projects/entities/projects/entity/src/new_prepend.rb +2 -2
- data/projects/entities/projects/entity/src/not_found_error.rb +8 -8
- data/projects/entities/projects/entity/src/sensitive_value_removers/entity.rb +8 -5
- data/projects/entities/projects/in_memory_crud_driver_minimal/src/in_memory_minimal.rb +4 -4
- data/projects/entities/projects/model_attribute_helpers/lib/foobara/model_attribute_helpers.rb +0 -2
- data/projects/entities/projects/model_attribute_helpers/src/attribute_helper_aliases.rb +1 -1
- data/projects/entities/projects/model_attribute_helpers/src/attribute_helpers.rb +2 -2
- data/projects/entities/projects/nested_transactionable/lib/foobara/nested_transactionable.rb +5 -5
- data/projects/entities/projects/persistence/lib/foobara/persistence.rb +1 -1
- data/projects/entities/projects/persistence/src/entity_attributes_crud_driver.rb +35 -37
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/entity_callback_handling.rb +25 -25
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/state_transitions.rb +8 -8
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/transaction_tracking.rb +1 -1
- data/projects/entities/projects/persistence/src/entity_base/transaction.rb +9 -9
- data/projects/entities/projects/persistence/src/entity_base/transaction_table/concerns/record_tracking.rb +4 -4
- data/projects/entities/projects/persistence/src/entity_base/transaction_table.rb +52 -52
- data/projects/entities/projects/persistence/src/entity_base.rb +7 -7
- data/projects/entities/projects/persistence/src/persistence.rb +23 -23
- data/projects/entities/projects/weak_object_set/src/weak_object_set.rb +16 -16
- data/projects/entities_plumbing/lib/foobara/entities_plumbing.rb +6 -2
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entities.rb +21 -5
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_errors_type.rb +23 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_inputs.rb +33 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_reflection.rb +39 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/runtime.rb +39 -0
- data/projects/manifest/src/base_manifest.rb +9 -9
- data/projects/manifest/src/model.rb +4 -4
- data/projects/manifest/src/type.rb +3 -3
- data/projects/manifest/src/type_declaration.rb +4 -4
- data/projects/model_plumbing/lib/foobara/model_plumbing.rb +2 -0
- data/projects/model_plumbing/src/extensions/command_pattern_implementation/concerns/model_inputs_type.rb +35 -0
- data/projects/typesystem/projects/builtin_types/lib/foobara/builtin_types.rb +2 -1
- data/projects/typesystem/projects/builtin_types/src/builtin_types.rb +8 -8
- data/projects/typesystem/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/module_desugarizer.rb +2 -2
- data/projects/typesystem/projects/builtin_types/src/email/validator_base.rb +4 -4
- data/projects/typesystem/projects/callback/src/block/concerns/block_parameter_required.rb +2 -2
- data/projects/typesystem/projects/callback/src/block/concerns/keyword_argumentable_block.rb +2 -2
- data/projects/typesystem/projects/callback/src/block/concerns/single_argument_block.rb +2 -2
- data/projects/typesystem/projects/callback/src/block.rb +4 -4
- data/projects/typesystem/projects/callback/src/registry/base.rb +10 -10
- data/projects/typesystem/projects/callback/src/registry/conditioned.rb +2 -2
- data/projects/typesystem/projects/callback/src/registry/multiple_action.rb +6 -6
- data/projects/typesystem/projects/callback/src/runner.rb +4 -4
- data/projects/typesystem/projects/callback/src/set.rb +4 -4
- data/projects/typesystem/projects/common/src/data_path.rb +14 -14
- data/projects/typesystem/projects/common/src/error.rb +11 -11
- data/projects/typesystem/projects/common/src/error_collection.rb +14 -14
- data/projects/typesystem/projects/common/src/error_key.rb +5 -3
- data/projects/typesystem/projects/common/src/outcome.rb +5 -5
- data/projects/typesystem/projects/common/src/possible_error.rb +2 -2
- data/projects/typesystem/projects/concerns/src/concern.rb +3 -3
- data/projects/typesystem/projects/delegate/src/extensions/module.rb +4 -4
- data/projects/typesystem/projects/domain/lib/foobara/domain.rb +2 -2
- data/projects/typesystem/projects/domain/src/domain.rb +5 -5
- data/projects/typesystem/projects/domain/src/domain_module_extension.rb +22 -22
- data/projects/typesystem/projects/domain/src/extensions/foobara.rb +14 -6
- data/projects/typesystem/projects/domain/src/module_extension.rb +4 -4
- data/projects/typesystem/projects/domain/src/organization.rb +6 -6
- data/projects/typesystem/projects/enumerated/src/accessors.rb +4 -4
- data/projects/typesystem/projects/enumerated/src/values.rb +14 -14
- data/projects/{entities → typesystem}/projects/model/lib/foobara/model.rb +1 -1
- data/projects/{entities → typesystem}/projects/model/src/concerns/classes.rb +4 -4
- data/projects/{entities → typesystem}/projects/model/src/concerns/types.rb +5 -5
- data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/casters/hash.rb +1 -1
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +2 -2
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/model_class_desugarizer.rb +6 -6
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +4 -4
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration.rb +2 -2
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/registered_type_declaration/model_class_desugarizer.rb +6 -10
- data/projects/{entities → typesystem}/projects/model/src/model.rb +13 -13
- data/projects/{entities → typesystem}/projects/model/src/sensitive_value_removers/model.rb +1 -1
- data/projects/typesystem/projects/namespace/src/ambiguous_registry.rb +5 -5
- data/projects/typesystem/projects/namespace/src/base_registry.rb +8 -8
- data/projects/typesystem/projects/namespace/src/is_namespace.rb +19 -19
- data/projects/typesystem/projects/namespace/src/namespace/lookup_mode.rb +2 -2
- data/projects/typesystem/projects/namespace/src/namespace.rb +5 -5
- data/projects/typesystem/projects/namespace/src/namespace_helpers.rb +4 -4
- data/projects/typesystem/projects/namespace/src/prefixless_registry.rb +3 -3
- data/projects/typesystem/projects/namespace/src/scoped.rb +7 -7
- data/projects/typesystem/projects/project/src/foobara.rb +13 -7
- data/projects/typesystem/projects/project/src/project.rb +1 -1
- data/projects/typesystem/projects/state_machine/src/callbacks.rb +14 -14
- data/projects/typesystem/projects/state_machine/src/state_machine.rb +2 -2
- data/projects/typesystem/projects/state_machine/src/sugar.rb +3 -3
- data/projects/typesystem/projects/type_declarations/lib/foobara/type_declarations.rb +1 -1
- data/projects/typesystem/projects/type_declarations/src/attributes.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/from_yaml.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/reject.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb +4 -4
- data/projects/typesystem/projects/type_declarations/src/desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/dsl/attributes.rb +9 -9
- data/projects/typesystem/projects/type_declarations/src/error_extension.rb +6 -6
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/array_desugarizer.rb +3 -3
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/element_type_declaration_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_registered_type_declaration.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_tuple_type_declaration/array_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/registered_type_declaration.rb +4 -3
- data/projects/typesystem/projects/type_declarations/src/remove_sensitive_values_transformer.rb +3 -3
- data/projects/typesystem/projects/type_declarations/src/type_builder.rb +5 -5
- data/projects/typesystem/projects/type_declarations/src/type_declaration.rb +7 -1
- data/projects/typesystem/projects/type_declarations/src/type_declaration_handler.rb +13 -13
- data/projects/typesystem/projects/type_declarations/src/type_declaration_handler_registry.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/type_declaration_validator.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/type_declarations.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/with_registries.rb +2 -2
- data/projects/typesystem/projects/types/lib/foobara/types.rb +0 -2
- data/projects/typesystem/projects/types/src/extensions/error.rb +5 -5
- data/projects/typesystem/projects/types/src/type/concerns/reflection.rb +22 -22
- data/projects/typesystem/projects/types/src/type/concerns/supported_processor_registration.rb +4 -4
- data/projects/typesystem/projects/types/src/type.rb +25 -25
- data/projects/typesystem/projects/value/src/caster.rb +11 -11
- data/projects/typesystem/projects/value/src/data_error.rb +1 -1
- data/projects/typesystem/projects/value/src/mutator.rb +3 -3
- data/projects/typesystem/projects/value/src/processor/casting.rb +6 -6
- data/projects/typesystem/projects/value/src/processor/pipeline.rb +2 -2
- data/projects/typesystem/projects/value/src/processor/runner.rb +1 -1
- data/projects/typesystem/projects/value/src/processor/selection.rb +3 -3
- data/projects/typesystem/projects/value/src/processor.rb +23 -23
- data/projects/typesystem/projects/value/src/transformer.rb +5 -5
- data/projects/typesystem/projects/value/src/validator.rb +3 -3
- data/version.rb +2 -2
- metadata +44 -160
- data/projects/command_connectors/Guardfile +0 -6
- data/projects/command_connectors/spec/allowed_rules_spec.rb +0 -77
- data/projects/command_connectors/spec/ambiguous_lookups_spec.rb +0 -143
- data/projects/command_connectors/spec/auth_mappers_spec.rb +0 -201
- data/projects/command_connectors/spec/command_connector_spec.rb +0 -2460
- data/projects/command_connectors/spec/command_registry_spec.rb +0 -9
- data/projects/command_connectors/spec/commands/describe_spec.rb +0 -83
- data/projects/command_connectors/spec/commands/ping_spec.rb +0 -14
- data/projects/command_connectors/spec/commands/query_git_commit_info_spec.rb +0 -55
- data/projects/command_connectors/spec/fixtures/command_connectors/manifest_with_errors_with_missing_command_parents.yaml +0 -1662
- data/projects/command_connectors/spec/not_found_error_spec.rb +0 -17
- data/projects/command_connectors/spec/pre_commit_transformers/load_atoms_pre_commit_transformer_spec.rb +0 -108
- data/projects/command_connectors/spec/request_spec.rb +0 -118
- data/projects/command_connectors/spec/serializer_spec.rb +0 -9
- data/projects/command_connectors/spec/serializers/aggregate_serializer_spec.rb +0 -45
- data/projects/command_connectors/spec/serializers/atomic_serializer_spec.rb +0 -68
- data/projects/command_connectors/spec/serializers/entities_to_primary_keys_serializer_spec.rb +0 -36
- data/projects/command_connectors/spec/serializers/json_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/serializers/noop_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/serializers/yaml_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/spec_helper.rb +0 -56
- data/projects/command_connectors/spec/support/rubyprof.rb +0 -32
- data/projects/command_connectors/spec/support/term_trap.rb +0 -6
- data/projects/command_connectors/spec/transformers/entity_to_primary_key_inputs_transformer_spec.rb +0 -119
- data/projects/entities/Guardfile +0 -6
- data/projects/entities/spec/builtin_types/detached_entity_spec.rb +0 -300
- data/projects/entities/spec/builtin_types/entity_spec.rb +0 -501
- data/projects/entities/spec/builtin_types/model_spec.rb +0 -420
- data/projects/entities/spec/detached_entity/casting_spec.rb +0 -31
- data/projects/entities/spec/entity/concerns/associations_spec.rb +0 -73
- data/projects/entities/spec/entity/concerns/attribute_helpers_spec.rb +0 -220
- data/projects/entities/spec/entity/concerns/callbacks_spec.rb +0 -61
- data/projects/entities/spec/entity/concerns/initialization_spec.rb +0 -213
- data/projects/entities/spec/entity/concerns/mutations_spec.rb +0 -38
- data/projects/entities/spec/entity/concerns/queries_spec.rb +0 -184
- data/projects/entities/spec/entity/entity_spec.rb +0 -240
- data/projects/entities/spec/entity/extending_existing_spec.rb +0 -137
- data/projects/entities/spec/entity/extensions/domain_module_extension_spec.rb +0 -42
- data/projects/entities/spec/entity/from_type_declaration_spec.rb +0 -34
- data/projects/entities/spec/entity/that_owns_spec.rb +0 -243
- data/projects/entities/spec/entity/weak_object_set_spec.rb +0 -91
- data/projects/entities/spec/model/model_spec.rb +0 -135
- data/projects/entities/spec/model/types_spec.rb +0 -397
- data/projects/entities/spec/nested_transactionable/nested_transactionable_spec.rb +0 -67
- data/projects/entities/spec/persistence/entity_attributes_crud_drivers/in_memory_minimal_spec.rb +0 -13
- data/projects/entities/spec/persistence/entity_base/transaction_spec.rb +0 -509
- data/projects/entities/spec/persistence/entity_base/transaction_table_spec.rb +0 -58
- data/projects/entities/spec/persistence/persistence_spec.rb +0 -148
- data/projects/entities/spec/spec_helper.rb +0 -54
- data/projects/entities/spec/support/rubyprof.rb +0 -32
- data/projects/entities/spec/support/term_trap.rb +0 -6
- data/projects/entities/spec/type_declarations/sensitive_type_removers_spec.rb +0 -90
- data/projects/entities_plumbing/Guardfile +0 -6
- data/projects/entities_plumbing/spec/auth_mappers_spec.rb +0 -159
- data/projects/entities_plumbing/spec/spec_helper.rb +0 -55
- data/projects/entities_plumbing/spec/support/rubyprof.rb +0 -32
- data/projects/entities_plumbing/spec/support/term_trap.rb +0 -6
- data/projects/entities_plumbing/spec/transaction_spec.rb +0 -534
- data/projects/manifest/Guardfile +0 -6
- data/projects/manifest/spec/associations_spec.rb +0 -67
- data/projects/manifest/spec/manifest_spec.rb +0 -382
- data/projects/manifest/spec/model_spec.rb +0 -126
- data/projects/manifest/spec/spec_helper.rb +0 -54
- data/projects/manifest/spec/type_declaration_spec.rb +0 -39
- data/projects/manifest/spec/type_spec.rb +0 -30
- data/projects/typesystem/spec/builtin_types/allow_nil_spec.rb +0 -138
- data/projects/typesystem/spec/builtin_types/array_spec.rb +0 -140
- data/projects/typesystem/spec/builtin_types/associative_array_spec.rb +0 -228
- data/projects/typesystem/spec/builtin_types/attributes_spec.rb +0 -490
- data/projects/typesystem/spec/builtin_types/big_decimal_spec.rb +0 -42
- data/projects/typesystem/spec/builtin_types/boolean_spec.rb +0 -43
- data/projects/typesystem/spec/builtin_types/class_type_desugarizer_spec.rb +0 -17
- data/projects/typesystem/spec/builtin_types/custom_type_spec.rb +0 -430
- data/projects/typesystem/spec/builtin_types/date_spec.rb +0 -37
- data/projects/typesystem/spec/builtin_types/datetime_spec.rb +0 -49
- data/projects/typesystem/spec/builtin_types/email_spec.rb +0 -44
- data/projects/typesystem/spec/builtin_types/float_spec.rb +0 -59
- data/projects/typesystem/spec/builtin_types/instance_of_spec.rb +0 -75
- data/projects/typesystem/spec/builtin_types/one_of_spec.rb +0 -73
- data/projects/typesystem/spec/builtin_types/string_spec.rb +0 -117
- data/projects/typesystem/spec/builtin_types/symbol_spec.rb +0 -24
- data/projects/typesystem/spec/builtin_types/tuple_spec.rb +0 -125
- data/projects/typesystem/spec/callback/callback_spec.rb +0 -155
- data/projects/typesystem/spec/callback/registry/conditioned_spec.rb +0 -152
- data/projects/typesystem/spec/callback/registry/multiple_action_spec.rb +0 -144
- data/projects/typesystem/spec/callback/registry/single_action_spec.rb +0 -114
- data/projects/typesystem/spec/common/data_path_spec.rb +0 -268
- data/projects/typesystem/spec/common/error_collection_spec.rb +0 -77
- data/projects/typesystem/spec/common/error_key_spec.rb +0 -56
- data/projects/typesystem/spec/common/outcome_spec.rb +0 -65
- data/projects/typesystem/spec/common/possible_error_spec.rb +0 -17
- data/projects/typesystem/spec/concerns/concern_spec.rb +0 -122
- data/projects/typesystem/spec/enumerated/accessors_spec.rb +0 -182
- data/projects/typesystem/spec/enumerated/enumerated_spec.rb +0 -32
- data/projects/typesystem/spec/enumerated/values_spec.rb +0 -67
- data/projects/typesystem/spec/foobara/foobara_spec.rb +0 -45
- data/projects/typesystem/spec/namespace/ambiguous_registry_spec.rb +0 -70
- data/projects/typesystem/spec/namespace/foobara_simulation_spec.rb +0 -254
- data/projects/typesystem/spec/namespace/is_namespace_spec.rb +0 -103
- data/projects/typesystem/spec/namespace/namespace_helpers_spec.rb +0 -67
- data/projects/typesystem/spec/namespace/namespace_spec.rb +0 -335
- data/projects/typesystem/spec/namespace/prefixless_registry_spec.rb +0 -30
- data/projects/typesystem/spec/namespace/unambiguous_registry_spec.rb +0 -50
- data/projects/typesystem/spec/spec_helper.rb +0 -52
- data/projects/typesystem/spec/state_machine/callbacks_spec.rb +0 -144
- data/projects/typesystem/spec/state_machine/state_machine_spec.rb +0 -224
- data/projects/typesystem/spec/state_machine/target_attribute_spec.rb +0 -46
- data/projects/typesystem/spec/support/rubyprof.rb +0 -32
- data/projects/typesystem/spec/support/term_trap.rb +0 -6
- data/projects/typesystem/spec/type_declarations/attributes_spec.rb +0 -14
- data/projects/typesystem/spec/type_declarations/attributes_transformer_spec.rb +0 -95
- data/projects/typesystem/spec/type_declarations/dsl/attributes_spec.rb +0 -107
- data/projects/typesystem/spec/type_declarations/handlers/extend_registered_type_declaration_spec.rb +0 -13
- data/projects/typesystem/spec/type_declarations/sensitive_type_removers_spec.rb +0 -210
- data/projects/typesystem/spec/type_declarations/type_builder_spec.rb +0 -47
- data/projects/typesystem/spec/type_declarations/type_declaration_spec.rb +0 -252
- data/projects/typesystem/spec/type_declarations/type_declarations_spec.rb +0 -11
- data/projects/typesystem/spec/type_declarations/typed_transformer_spec.rb +0 -65
- data/projects/typesystem/spec/types/sensitive_spec.rb +0 -36
- data/projects/typesystem/spec/types/type_spec.rb +0 -102
- data/projects/typesystem/spec/value/caster_spec.rb +0 -23
- data/projects/typesystem/spec/value/processor/runner_spec.rb +0 -34
- data/projects/typesystem/spec/value/processor/selection_spec.rb +0 -71
- data/projects/typesystem/spec/value/processor_spec.rb +0 -76
- data/projects/typesystem/spec/value/transformer_spec.rb +0 -27
- /data/projects/{command/src → entities_plumbing/src/extensions}/command_pattern_implementation/concerns/transactions.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/concerns/aliases.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/concerns/reflection.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/supported_transformers/mutable.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/validators/model_instance_is_valid.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_validator.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/move_private_from_element_types_to_root.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/symbolize_private.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/valid_attribute_names.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/hash_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/model_class_type_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/mutable_validator.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/normalize_mutable_attributes_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/to_type_transformer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/lazy_element_types/model.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/sensitive_type_removers/extended_model.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/sensitive_type_removers/model.rb +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Foobara
|
|
2
|
+
module CommandPatternImplementation
|
|
3
|
+
module Concerns
|
|
4
|
+
module EntityReflection
|
|
5
|
+
include Concern
|
|
6
|
+
|
|
7
|
+
module ClassMethods
|
|
8
|
+
def types_depended_on
|
|
9
|
+
# These lookups are duplicative of the overriden method as well as other methods.
|
|
10
|
+
# Likely there's some way to DRY this up
|
|
11
|
+
remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?
|
|
12
|
+
|
|
13
|
+
if defined?(@types_depended_on) && @types_depended_on.key?(remove_sensitive)
|
|
14
|
+
return @types_depended_on[remove_sensitive]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@types_depended_on ||= {}
|
|
18
|
+
@types_depended_on[remove_sensitive] = begin
|
|
19
|
+
types = super
|
|
20
|
+
|
|
21
|
+
unless depends_on_entities.empty?
|
|
22
|
+
entity_types = depends_on_entities.map(&:entity_type)
|
|
23
|
+
|
|
24
|
+
if remove_sensitive
|
|
25
|
+
entity_types = entity_types.reject(&:sensitive?)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
types |= entity_types
|
|
29
|
+
types |= entity_types.map(&:types_depended_on).inject(:|)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
types
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/runtime.rb
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Foobara
|
|
2
|
+
module CommandPatternImplementation
|
|
3
|
+
module Concerns
|
|
4
|
+
module Runtime
|
|
5
|
+
def validate_records
|
|
6
|
+
self.class.inputs_association_paths&.each do |data_path|
|
|
7
|
+
if data_path.last == :"#"
|
|
8
|
+
records = data_path.values_at(@inputs)
|
|
9
|
+
|
|
10
|
+
records.each.with_index do |record, index|
|
|
11
|
+
if record&.persisted? && !record.loaded?
|
|
12
|
+
begin
|
|
13
|
+
record.class.load(record)
|
|
14
|
+
rescue Foobara::Entity::NotFoundError => e
|
|
15
|
+
e.prepend_path!(index)
|
|
16
|
+
e.prepend_path!(data_path.path[..-2])
|
|
17
|
+
|
|
18
|
+
add_input_error(e)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
record = data_path.value_at(@inputs)
|
|
24
|
+
|
|
25
|
+
if record&.persisted? && !record.loaded?
|
|
26
|
+
begin
|
|
27
|
+
record.class.load(record)
|
|
28
|
+
rescue Foobara::Entity::NotFoundError => e
|
|
29
|
+
e.prepend_path!(data_path)
|
|
30
|
+
add_input_error(e)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -55,17 +55,17 @@ module Foobara
|
|
|
55
55
|
self.manifest_path = manifest_path
|
|
56
56
|
|
|
57
57
|
if relevant_manifest.nil?
|
|
58
|
-
# :
|
|
58
|
+
# simplecov:disable
|
|
59
59
|
raise InvalidPath, "invalid path #{manifest_path}"
|
|
60
|
-
# :
|
|
60
|
+
# simplecov:enable
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def path
|
|
65
|
-
# :
|
|
65
|
+
# simplecov:disable
|
|
66
66
|
warn "[DEPRECATION] `path` is deprecated. Please use `manifest_path` instead."
|
|
67
67
|
manifest_path
|
|
68
|
-
# :
|
|
68
|
+
# simplecov:enable
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def domain
|
|
@@ -91,11 +91,11 @@ module Foobara
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def parent_category
|
|
94
|
-
self[:parent]&.
|
|
94
|
+
self[:parent]&.[](0)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def parent_name
|
|
98
|
-
self[:parent]&.
|
|
98
|
+
self[:parent]&.[](-1)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
def scoped_category
|
|
@@ -103,7 +103,7 @@ module Foobara
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def relevant_manifest
|
|
106
|
-
@relevant_manifest ||= Foobara::DataPath.values_at(manifest_path, root_manifest)
|
|
106
|
+
@relevant_manifest ||= Foobara::DataPath.values_at(manifest_path, root_manifest)[0]
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def find_type(type_declaration)
|
|
@@ -126,9 +126,9 @@ module Foobara
|
|
|
126
126
|
elsif optional_key?(method_name)
|
|
127
127
|
self.class.optional_key_defaults[method_name.to_sym]
|
|
128
128
|
else
|
|
129
|
-
# :
|
|
129
|
+
# simplecov:disable
|
|
130
130
|
super
|
|
131
|
-
# :
|
|
131
|
+
# simplecov:enable
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
@@ -28,14 +28,14 @@ module Foobara
|
|
|
28
28
|
type.attribute_declarations.each_pair do |attribute_name, element_type|
|
|
29
29
|
associations(element_type, path.append(attribute_name), result, initial: false)
|
|
30
30
|
end
|
|
31
|
-
# :
|
|
31
|
+
# simplecov:disable
|
|
32
32
|
elsif type.associative_array?
|
|
33
33
|
if contains_associations?(type)
|
|
34
34
|
raise "Associative array types with associations in them are not currently supported. " \
|
|
35
35
|
"Use attributes type if you can or set the key_type and/or value_type to duck type"
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
|
-
# :
|
|
38
|
+
# simplecov:enable
|
|
39
39
|
|
|
40
40
|
result
|
|
41
41
|
end
|
|
@@ -87,9 +87,9 @@ module Foobara
|
|
|
87
87
|
when Type
|
|
88
88
|
type.entity?
|
|
89
89
|
else
|
|
90
|
-
# :
|
|
90
|
+
# simplecov:disable
|
|
91
91
|
raise "not sure how to proceed with #{type}"
|
|
92
|
-
# :
|
|
92
|
+
# simplecov:enable
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
end
|
|
@@ -64,12 +64,12 @@ module Foobara
|
|
|
64
64
|
|
|
65
65
|
def target_class
|
|
66
66
|
if target_classes.size != 1
|
|
67
|
-
# :
|
|
67
|
+
# simplecov:disable
|
|
68
68
|
raise "Can only use #target_class for types with one target class but #{name} has #{target_classes.size}"
|
|
69
|
-
# :
|
|
69
|
+
# simplecov:enable
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
target_classes
|
|
72
|
+
target_classes[0]
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def types_depended_on
|
|
@@ -130,9 +130,9 @@ module Foobara
|
|
|
130
130
|
raise "not an detached_entity" unless detached_entity?
|
|
131
131
|
|
|
132
132
|
if to_type.primitive?
|
|
133
|
-
# :
|
|
133
|
+
# simplecov:disable
|
|
134
134
|
raise "detached_entity extension instead of an detached_entity"
|
|
135
|
-
# :
|
|
135
|
+
# simplecov:enable
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
type = to_type
|
|
@@ -152,9 +152,9 @@ module Foobara
|
|
|
152
152
|
raise "not an entity" unless entity?
|
|
153
153
|
|
|
154
154
|
if to_type.primitive?
|
|
155
|
-
# :
|
|
155
|
+
# simplecov:disable
|
|
156
156
|
raise "entity extension instead of an entity"
|
|
157
|
-
# :
|
|
157
|
+
# simplecov:enable
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
type = to_type
|
|
@@ -5,6 +5,8 @@ module Foobara
|
|
|
5
5
|
Model.on_reregister do
|
|
6
6
|
GlobalDomain.foobara_each_command(&:handle_reregistered_types!)
|
|
7
7
|
end
|
|
8
|
+
|
|
9
|
+
CommandPatternImplementation.include Foobara::CommandPatternImplementation::Concerns::ModelInputsType
|
|
8
10
|
Foobara::DomainMapper.singleton_class.prepend(Foobara::ModelPlumbing::DomainMapperExtension)
|
|
9
11
|
end
|
|
10
12
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Foobara
|
|
2
|
+
module CommandPatternImplementation
|
|
3
|
+
module Concerns
|
|
4
|
+
module ModelInputsType
|
|
5
|
+
include Concern
|
|
6
|
+
|
|
7
|
+
module ClassMethods
|
|
8
|
+
def inputs(*args, **opts, &)
|
|
9
|
+
if args.size == 1 && opts.empty?
|
|
10
|
+
type = args.first
|
|
11
|
+
|
|
12
|
+
if type.is_a?(::Class) && (type == Model || type < Model)
|
|
13
|
+
type = type.model_type
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
unless skip_model_to_attributes_conversion?(type)
|
|
17
|
+
if type.extends?(BuiltinTypes[:model])
|
|
18
|
+
return super(type.element_types)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def skip_model_to_attributes_conversion?(type)
|
|
29
|
+
!type.is_a?(Foobara::Type)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -2,6 +2,7 @@ require "foobara/type_declarations"
|
|
|
2
2
|
|
|
3
3
|
require "date"
|
|
4
4
|
require "time"
|
|
5
|
+
# TODO: get this out of here
|
|
5
6
|
require "bigdecimal"
|
|
6
7
|
|
|
7
8
|
module Foobara
|
|
@@ -67,7 +68,7 @@ module Foobara
|
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def reset_all
|
|
70
|
-
Foobara.raise_if_production!
|
|
71
|
+
Foobara.raise_if_production!
|
|
71
72
|
|
|
72
73
|
builtin_types.each do |builtin_type|
|
|
73
74
|
builtin_type.foobara_each do |scoped|
|
|
@@ -42,9 +42,9 @@ module Foobara
|
|
|
42
42
|
transformers = []
|
|
43
43
|
transformer_classes&.each do |transformer_class|
|
|
44
44
|
if transformer_class.respond_to?(:requires_type?) && transformer_class.requires_type?
|
|
45
|
-
# :
|
|
45
|
+
# simplecov:disable
|
|
46
46
|
processor_classes_requiring_type << transformer_class
|
|
47
|
-
# :
|
|
47
|
+
# simplecov:enable
|
|
48
48
|
else
|
|
49
49
|
transformers << transformer_class.new_with_agnostic_args(parent_declaration_data: declaration_data)
|
|
50
50
|
end
|
|
@@ -57,9 +57,9 @@ module Foobara
|
|
|
57
57
|
validators = []
|
|
58
58
|
validator_classes&.each do |validator_class|
|
|
59
59
|
if validator_class.respond_to?(:requires_type?) && validator_class.requires_type?
|
|
60
|
-
# :
|
|
60
|
+
# simplecov:disable
|
|
61
61
|
processor_classes_requiring_type << validator_class
|
|
62
|
-
# :
|
|
62
|
+
# simplecov:enable
|
|
63
63
|
else
|
|
64
64
|
validators << validator_class.new_with_agnostic_args(parent_declaration_data: declaration_data)
|
|
65
65
|
end
|
|
@@ -164,9 +164,9 @@ module Foobara
|
|
|
164
164
|
handler_class_to_extend = TypeDeclarations::Handlers.const_get(handler_name)
|
|
165
165
|
|
|
166
166
|
unless handler_class_to_extend
|
|
167
|
-
# :
|
|
167
|
+
# simplecov:disable
|
|
168
168
|
raise "Couldn't find handler class for #{handler_name}"
|
|
169
|
-
# :
|
|
169
|
+
# simplecov:enable
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
handler_to_extend = global_type_declaration_handler_registry.type_declaration_handler_for_handler_class(
|
|
@@ -174,9 +174,9 @@ module Foobara
|
|
|
174
174
|
)
|
|
175
175
|
|
|
176
176
|
unless handler_to_extend
|
|
177
|
-
# :
|
|
177
|
+
# simplecov:disable
|
|
178
178
|
raise "Could not find a handler for #{handler_class_to_extend}"
|
|
179
|
-
# :
|
|
179
|
+
# simplecov:enable
|
|
180
180
|
end
|
|
181
181
|
|
|
182
182
|
desugarizer_module = Util.constant_value(handler_module, :Desugarizers)
|
|
@@ -28,9 +28,9 @@ module Foobara
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def regex
|
|
31
|
-
# :
|
|
32
|
-
raise
|
|
33
|
-
# :
|
|
31
|
+
# simplecov:disable
|
|
32
|
+
raise NotImplementedError
|
|
33
|
+
# simplecov:enable
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def negate_regex?
|
|
@@ -46,7 +46,7 @@ module Foobara
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def validation_errors(email)
|
|
49
|
-
build_error if email.
|
|
49
|
+
build_error if email.__send__(negate_regex? ? :=~ : :!~, regex)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -20,9 +20,9 @@ module Foobara
|
|
|
20
20
|
|
|
21
21
|
if has_keyword_args? && has_positional_args?
|
|
22
22
|
# TODO: raise a real error
|
|
23
|
-
# :
|
|
23
|
+
# simplecov:disable
|
|
24
24
|
raise "Expect #{type} block to either take a positional arg or keyword args but not both"
|
|
25
|
-
# :
|
|
25
|
+
# simplecov:enable
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -9,10 +9,10 @@ module Foobara
|
|
|
9
9
|
super
|
|
10
10
|
|
|
11
11
|
if has_keyword_args?
|
|
12
|
-
# :
|
|
12
|
+
# simplecov:disable
|
|
13
13
|
raise ArgumentError,
|
|
14
14
|
"Expect #{type} block to only receive one or zero arguments. It cannot take keyword arguments."
|
|
15
|
-
# :
|
|
15
|
+
# simplecov:enable
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -43,14 +43,14 @@ module Foobara
|
|
|
43
43
|
def validate_original_block!
|
|
44
44
|
unless has_one_or_zero_positional_args?
|
|
45
45
|
# TODO: raise a real error
|
|
46
|
-
# :
|
|
46
|
+
# simplecov:disable
|
|
47
47
|
raise "Can't pass multiple arguments to a callback. Only 1 or 0 arguments."
|
|
48
|
-
# :
|
|
48
|
+
# simplecov:enable
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def takes_block?
|
|
53
|
-
@takes_block ||= original_block.parameters
|
|
53
|
+
@takes_block ||= original_block.parameters[-1]&.[](0)&.==(:block) || false
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def has_one_or_zero_positional_args?
|
|
@@ -58,7 +58,7 @@ module Foobara
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def has_keyword_args?
|
|
61
|
-
@has_keyword_args ||= param_types.
|
|
61
|
+
@has_keyword_args ||= param_types.intersect?([:keyreq, :keyrest])
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def has_positional_args?
|
|
@@ -8,9 +8,9 @@ module Foobara
|
|
|
8
8
|
|
|
9
9
|
def register_callback(type, *, **, &callback_block)
|
|
10
10
|
unless block_given?
|
|
11
|
-
# :
|
|
11
|
+
# simplecov:disable
|
|
12
12
|
raise ArgumentError, "Must provide a callback block to register"
|
|
13
|
-
# :
|
|
13
|
+
# simplecov:enable
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
validate_type!(type)
|
|
@@ -21,15 +21,15 @@ module Foobara
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def specific_callback_set_for(*_args, **_opts)
|
|
24
|
-
# :
|
|
25
|
-
raise
|
|
26
|
-
# :
|
|
24
|
+
# simplecov:disable
|
|
25
|
+
raise NotImplementedError
|
|
26
|
+
# simplecov:enable
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def unioned_callback_set_for(*_args, **_opts)
|
|
30
|
-
# :
|
|
31
|
-
raise
|
|
32
|
-
# :
|
|
30
|
+
# simplecov:disable
|
|
31
|
+
raise NotImplementedError
|
|
32
|
+
# simplecov:enable
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def before(...)
|
|
@@ -79,9 +79,9 @@ module Foobara
|
|
|
79
79
|
def validate_type!(type)
|
|
80
80
|
unless allowed_types.include?(type)
|
|
81
81
|
# TODO: raise a real error
|
|
82
|
-
# :
|
|
82
|
+
# simplecov:disable
|
|
83
83
|
raise "bad type #{type} expected one of #{allowed_types}"
|
|
84
|
-
# :
|
|
84
|
+
# simplecov:enable
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
end
|
|
@@ -38,9 +38,9 @@ module Foobara
|
|
|
38
38
|
|
|
39
39
|
def validate_conditions!(**conditions)
|
|
40
40
|
unless conditions.is_a?(Hash)
|
|
41
|
-
# :
|
|
41
|
+
# simplecov:disable
|
|
42
42
|
raise InvalidConditions, "Expected a hash"
|
|
43
|
-
# :
|
|
43
|
+
# simplecov:enable
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
conditions.each_pair do |condition_name, condition_value|
|
|
@@ -73,26 +73,26 @@ module Foobara
|
|
|
73
73
|
when 0
|
|
74
74
|
nil
|
|
75
75
|
when 1
|
|
76
|
-
action = actions
|
|
76
|
+
action = actions[0]
|
|
77
77
|
validate_action!(action)
|
|
78
78
|
action
|
|
79
79
|
else
|
|
80
|
-
# :
|
|
80
|
+
# simplecov:disable
|
|
81
81
|
raise ArgumentError, "Can either pass an action or not but can't pass multiple"
|
|
82
|
-
# :
|
|
82
|
+
# simplecov:enable
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def normalize_actions(actions, validate = true)
|
|
87
|
-
first = actions
|
|
87
|
+
first = actions[0]
|
|
88
88
|
|
|
89
89
|
if first.is_a?(Array)
|
|
90
90
|
if actions.size == 1
|
|
91
91
|
normalize_actions(first, validate)
|
|
92
92
|
else
|
|
93
|
-
# :
|
|
93
|
+
# simplecov:disable
|
|
94
94
|
raise ArgumentError, "Not expecting an array of arrays, expected an array of actions"
|
|
95
|
-
# :
|
|
95
|
+
# simplecov:enable
|
|
96
96
|
end
|
|
97
97
|
elsif actions.empty?
|
|
98
98
|
[nil]
|
|
@@ -46,14 +46,14 @@ module Foobara
|
|
|
46
46
|
else
|
|
47
47
|
# TODO: raise better errors
|
|
48
48
|
if callback_set.has_before_callbacks?
|
|
49
|
-
# :
|
|
49
|
+
# simplecov:disable
|
|
50
50
|
raise
|
|
51
|
-
# :
|
|
51
|
+
# simplecov:enable
|
|
52
52
|
end
|
|
53
53
|
if callback_set.has_around_callbacks?
|
|
54
|
-
# :
|
|
54
|
+
# simplecov:disable
|
|
55
55
|
raise
|
|
56
|
-
# :
|
|
56
|
+
# simplecov:enable
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -7,7 +7,7 @@ module Foobara
|
|
|
7
7
|
self.callbacks = {}
|
|
8
8
|
|
|
9
9
|
callback_hash.each do |type, blocks|
|
|
10
|
-
|
|
10
|
+
__send__("#{type}=", blocks.dup)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -33,7 +33,7 @@ module Foobara
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def [](type)
|
|
36
|
-
|
|
36
|
+
__send__(type)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
Block.types.each do |type|
|
|
@@ -46,11 +46,11 @@ module Foobara
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
define_method "each_#{type}" do |&block|
|
|
49
|
-
|
|
49
|
+
__send__(type).each(&block)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
define_method "has_#{type}_callbacks?" do
|
|
53
|
-
!
|
|
53
|
+
!__send__(type).empty?
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
@@ -103,7 +103,7 @@ module Foobara
|
|
|
103
103
|
|
|
104
104
|
def prepend!(*prepend_parts)
|
|
105
105
|
if prepend_parts.size == 1
|
|
106
|
-
arg = prepend_parts
|
|
106
|
+
arg = prepend_parts[0]
|
|
107
107
|
|
|
108
108
|
if arg.is_a?(Array)
|
|
109
109
|
prepend_parts = arg
|
|
@@ -122,7 +122,7 @@ module Foobara
|
|
|
122
122
|
|
|
123
123
|
def append!(*append_parts)
|
|
124
124
|
if append_parts.size == 1
|
|
125
|
-
arg = append_parts
|
|
125
|
+
arg = append_parts[0]
|
|
126
126
|
|
|
127
127
|
if arg.is_a?(Array)
|
|
128
128
|
append_parts = arg
|
|
@@ -174,12 +174,12 @@ module Foobara
|
|
|
174
174
|
raise TooManyValuesAtPathError.new(path, values)
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
-
values
|
|
177
|
+
values[0]
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
def set_value_at(object, value, parts = path)
|
|
181
181
|
owner = value_at(object, parts[0..-2])
|
|
182
|
-
index = parts
|
|
182
|
+
index = parts[-1]
|
|
183
183
|
|
|
184
184
|
if owner.is_a?(::Hash)
|
|
185
185
|
if owner.key?(index.to_s)
|
|
@@ -192,11 +192,11 @@ module Foobara
|
|
|
192
192
|
else
|
|
193
193
|
method = "#{index}="
|
|
194
194
|
if owner.respond_to?(method)
|
|
195
|
-
owner.
|
|
195
|
+
owner.__send__(method, value)
|
|
196
196
|
else
|
|
197
|
-
# :
|
|
197
|
+
# simplecov:disable
|
|
198
198
|
raise BadPathError, "Bad path: #{parts}"
|
|
199
|
-
# :
|
|
199
|
+
# simplecov:enable
|
|
200
200
|
end
|
|
201
201
|
end
|
|
202
202
|
|
|
@@ -206,7 +206,7 @@ module Foobara
|
|
|
206
206
|
# Helper method that determines if the path points to an array and none of the atoms along the way are also arrays.
|
|
207
207
|
# And that there's at least one atom (we are going to consider a collection to be "named" not an anonymous array.)
|
|
208
208
|
def simple_collection?
|
|
209
|
-
path.size > 1 && path
|
|
209
|
+
path.size > 1 && path[-1] == :"#" && path[0..-2].none? { |part| part == :"#" }
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
def ==(other)
|
|
@@ -214,7 +214,7 @@ module Foobara
|
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
def last
|
|
217
|
-
path
|
|
217
|
+
path[-1]
|
|
218
218
|
end
|
|
219
219
|
|
|
220
220
|
def empty?
|
|
@@ -250,10 +250,10 @@ module Foobara
|
|
|
250
250
|
key_parts.to_sym
|
|
251
251
|
end
|
|
252
252
|
else
|
|
253
|
-
# :
|
|
253
|
+
# simplecov:disable
|
|
254
254
|
raise ArgumentError,
|
|
255
255
|
"expected nil, a symbol, or a string, an integer, or an array of such values but was a #{key_parts.class}"
|
|
256
|
-
# :
|
|
256
|
+
# simplecov:enable
|
|
257
257
|
end
|
|
258
258
|
end
|
|
259
259
|
|
|
@@ -274,15 +274,15 @@ module Foobara
|
|
|
274
274
|
object[path_part]
|
|
275
275
|
end
|
|
276
276
|
else
|
|
277
|
-
object.
|
|
277
|
+
object.__send__(path_part)
|
|
278
278
|
end
|
|
279
279
|
end
|
|
280
280
|
when Integer
|
|
281
281
|
objects.map { |value| value[path_part] }
|
|
282
282
|
else
|
|
283
|
-
# :
|
|
283
|
+
# simplecov:disable
|
|
284
284
|
raise "Bad path part: #{path_part.inspect}"
|
|
285
|
-
# :
|
|
285
|
+
# simplecov:enable
|
|
286
286
|
end.compact
|
|
287
287
|
|
|
288
288
|
_values_at(objects, parts)
|