Class: Foobara::TypeDeclarations::RemoveSensitiveValuesTransformer
- Inherits:
-
TypedTransformer
- Object
- Value::Processor
- Value::Transformer
- TypedTransformer
- Foobara::TypeDeclarations::RemoveSensitiveValuesTransformer
- Defined in:
- foobara-0.0.110/projects/type_declarations/src/remove_sensitive_values_transformer.rb
Direct Known Subclasses
Model::SensitiveValueRemovers::Model, SensitiveValueRemovers::Array, SensitiveValueRemovers::Attributes
Instance Attribute Summary
Attributes inherited from Value::Processor
#created_in_namespace, #declaration_data, #parent_declaration_data
Instance Method Summary collapse
- #from ⇒ Object
- #sanitize_value(type, value) ⇒ Object
- #to_type_declaration ⇒ Object
- #transform(_value) ⇒ Object
Methods inherited from TypedTransformer
from, #from_type, #from_type_declaration, #has_from_type?, #has_to_type?, #initialize, #process_value, requires_declaration_data?, requires_parent_declaration_data?, to, #to, #to_type
Methods inherited from Value::Transformer
create, error_classes, foobara_manifest, #process_value, subclass
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, #possible_errors, #priority, #process_outcome, #process_outcome!, #process_value, #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
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Constructor Details
This class inherits a constructor from Foobara::TypeDeclarations::TypedTransformer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::Value::Processor
Instance Method Details
#from ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'foobara-0.0.110/projects/type_declarations/src/remove_sensitive_values_transformer.rb', line 6 def from(...) super.tap do associations = Foobara::DetachedEntity.construct_deep_associations(from_type) associations&.values&.reverse&.each do |entity_type| next if entity_type.sensitive? next unless entity_type.has_sensitive_types? declaration = entity_type.declaration_data sanitized_type_declaration = TypeDeclarations.remove_sensitive_types(declaration) # We want to make sure that any types that change due to having sensitive types # has a corresponding registered type in the command registry domain if needed # TODO: this all feels so messy and brittle. Domain.current.(sanitized_type_declaration) end end end |
#sanitize_value(type, value) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'foobara-0.0.110/projects/type_declarations/src/remove_sensitive_values_transformer.rb', line 35 def sanitize_value(type, value) if type.has_sensitive_types? sanitized_value = Namespace.use to_type.created_in_namespace do remover_class = TypeDeclarations.sensitive_value_remover_class_for_type(type) remover = remover_class.new(from: type) remover.process_value!(value) end [sanitized_value, sanitized_value != value] else [value, false] end end |
#to_type_declaration ⇒ Object
25 26 27 |
# File 'foobara-0.0.110/projects/type_declarations/src/remove_sensitive_values_transformer.rb', line 25 def to_type_declaration TypeDeclarations.remove_sensitive_types(from_type.declaration_data) end |
#transform(_value) ⇒ Object
29 30 31 32 33 |
# File 'foobara-0.0.110/projects/type_declarations/src/remove_sensitive_values_transformer.rb', line 29 def transform(_value) # :nocov: raise "subclass responsibility" # :nocov: end |