Class: UniverseCompiler::Entity::Override

Inherits:
Base
  • Object
show all
Defined in:
lib/universe_compiler/override.rb

Constant Summary collapse

UNMERGEABLE_FIELDS =
%i(name type overrides scenario extends)

Constants included from FieldConstraintManagement

FieldConstraintManagement::BOOLEAN_CONSTRAINTS, FieldConstraintManagement::INCOMPATIBLE_CONSTRAINTS, FieldConstraintManagement::PARAMETRIZED_CONSTRAINTS

Instance Attribute Summary

Attributes inherited from Base

#fields, #universe

Attributes included from AutoNamed

#auto_named_entity_type_seed

Attributes included from Persistence

#source_uri

Attributes included from Inheritance

#compiled

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #initialize

Methods included from AutoNamed

#auto_named_entity_type, #auto_named_entity_type?, #get_unique_name

Methods included from FieldConstraintManagement

#define_constraint, #field, #fields_constraints

Methods included from RelationsManagement

#has_many, #has_one

Methods included from FieldBinder

#field_accessor, #field_reader, #field_writer

Methods included from Persistence

#delete, load, #save

Methods included from Overridden

#apply_override, #overridden_by

Methods included from Conversion

#==, #as_path, #encode_with, #eql?, #init_with, #inspect, #to_composite_key, #to_hash, #to_reference, #to_uniq_id

Methods included from Inheritance

#apply_inheritance, #valid_for_inheritance?

Methods included from Marshalling

#dereferenced_fields, #fully_resolved?, #resolve_fields_references, #resolve_fields_references!, #traverse_fields

Methods included from Validation

#invalid_fields, #valid?, #valid_for_fields_constraints?

Methods included from TypeManagement

extended, included, #type, type_class_mapping, types_classes_mapping, valid_for_type?

Methods included from Utils::DeepTraverse

#deep_map, #deep_traverse

Constructor Details

This class inherits a constructor from UniverseCompiler::Entity::Base

Instance Method Details

#apply_overridesObject



13
14
15
16
17
18
19
# File 'lib/universe_compiler/override.rb', line 13

def apply_overrides
  overrides.each do |override|
    fields_to_be_merged = fields.reject { |key, _| UNMERGEABLE_FIELDS.include? key }
    UniverseCompiler.logger.debug "Overriding '#{override.to_composite_key}' from overrides defined in '#{to_composite_key}'."
    override.apply_override fields_to_be_merged, self
  end
end