Sha256: 40f4692cfb0d6d70aeb152e77f99423bf1ffd00b2dc489a6d741a581f9db2f83

Contents?: true

Size: 654 Bytes

Versions: 29

Compression:

Stored size: 654 Bytes

Contents

module UniverseCompiler
  module Entity

    class Override < UniverseCompiler::Entity::Base

      UNMERGEABLE_FIELDS = %i(name type overrides scenario extends)

      entity_type :entity_override

      field :overrides, :is_array
      field_accessor :scenario

      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

    end

  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
universe_compiler-0.5.6 lib/universe_compiler/override.rb
universe_compiler-0.5.5 lib/universe_compiler/override.rb
universe_compiler-0.5.4 lib/universe_compiler/override.rb
universe_compiler-0.5.3 lib/universe_compiler/override.rb
universe_compiler-0.5.2 lib/universe_compiler/override.rb
universe_compiler-0.5.1 lib/universe_compiler/override.rb
universe_compiler-0.4.3 lib/universe_compiler/override.rb
universe_compiler-0.4.2 lib/universe_compiler/override.rb
universe_compiler-0.4.1 lib/universe_compiler/override.rb
universe_compiler-0.4.0 lib/universe_compiler/override.rb
universe_compiler-0.3.12 lib/universe_compiler/override.rb
universe_compiler-0.3.11 lib/universe_compiler/override.rb
universe_compiler-0.3.10 lib/universe_compiler/override.rb
universe_compiler-0.3.9 lib/universe_compiler/override.rb
universe_compiler-0.3.8 lib/universe_compiler/override.rb
universe_compiler-0.3.7 lib/universe_compiler/override.rb
universe_compiler-0.3.6 lib/universe_compiler/override.rb
universe_compiler-0.3.5 lib/universe_compiler/override.rb
universe_compiler-0.3.4 lib/universe_compiler/override.rb
universe_compiler-0.3.3 lib/universe_compiler/override.rb