lib/universe_compiler/universe/entities.rb in universe_compiler-0.5.3 vs lib/universe_compiler/universe/entities.rb in universe_compiler-0.5.4

- old
+ new

@@ -52,14 +52,12 @@ end end end end # Then delete the entity - if entity.respond_to? :'universe=' - entity.universe = nil - end entities.delete entity + entity.universe = nil if entity.respond_to? :'universe=' reindex_all entities unless impacted_entities.empty? UniverseCompiler.logger.warn "Impacts of '#{entity.as_path}' deletion:" impacted_entities.each do |k, v| UniverseCompiler.logger.warn " - '#{k.as_path}' fields : #{v.join ', '}" @@ -97,15 +95,11 @@ end end end # Then replace the entity entities[entities.index(entity)] = by - if entity.respond_to? :'universe=' - entity.universe = nil - end - if by.respond_to? :'universe=' - by.universe = self - end + entity.universe = nil if entity.respond_to? :'universe=' + by.universe = self if by.respond_to? :'universe=' reindex_all entities unless impacted_entities.empty? UniverseCompiler.logger.warn "Impacts of '#{entity.as_path}' deletion:" impacted_entities.each do |k, v| UniverseCompiler.logger.warn " - '#{k.as_path}' fields : #{v.join ', '}"