Class: Foobara::BuiltinTypes::AssociativeArray::SupportedProcessors::ValueTypeDeclaration
- Inherits:
-
TypeDeclarations::ElementProcessor
- Object
- Value::Processor
- Types::ElementProcessor
- TypeDeclarations::ElementProcessor
- Foobara::BuiltinTypes::AssociativeArray::SupportedProcessors::ValueTypeDeclaration
- Defined in:
- foobara-0.0.110/projects/builtin_types/src/associative_array/supported_processors/value_type_declaration.rb
Instance Attribute Summary
Attributes inherited from Value::Processor
#created_in_namespace, #declaration_data, #parent_declaration_data
Instance Method Summary collapse
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods inherited from Value::Processor
#always_applicable?, #applicable?, #attribute_name, #build_error, default_declaration_data, #dup_processor, error_class, error_classes, #error_context, #error_message, #error_path, foobara_manifest, #foobara_manifest, #initialize, #inspect, instance, #method_missing, #name, new_with_agnostic_args, #priority, #process_outcome, #process_outcome!, #process_value!, processor_name, requires_declaration_data?, requires_parent_declaration_data?, #respond_to_missing?, #runner, symbol
Methods included from IsManifestable
#foobara_domain, #foobara_manifest, #foobara_organization, #scoped_clear_caches
Constructor Details
This class inherits a constructor from Foobara::Value::Processor
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::Value::Processor
Instance Method Details
#possible_errors ⇒ Object
33 34 35 36 37 38 39 |
# File 'foobara-0.0.110/projects/builtin_types/src/associative_array/supported_processors/value_type_declaration.rb', line 33 def possible_errors super + value_type.possible_errors.map do |possible_error| possible_error = possible_error.dup possible_error.prepend_path!(:"#", :value) possible_error end end |
#process_value(attributes_hash) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'foobara-0.0.110/projects/builtin_types/src/associative_array/supported_processors/value_type_declaration.rb', line 10 def process_value(attributes_hash) errors = [] attributes_hash = attributes_hash.to_a.map.with_index do |(key, value), index| value_outcome = value_type.process_value(value) if value_outcome.success? value = value_outcome.result else value_outcome.each_error do |error| # Can' prepend path since we dont know if key is a symbolizable type... error.prepend_path!(index, :value) errors << error end end [key, value] end.to_h Outcome.new(result: attributes_hash, errors:) end |
#value_type ⇒ Object
6 7 8 |
# File 'foobara-0.0.110/projects/builtin_types/src/associative_array/supported_processors/value_type_declaration.rb', line 6 def value_type @value_type ||= type_for_declaration(value_type_declaration) end |