Module: UniverseCompiler::Universe::Compile

Includes:
UniverseCompiler::Utils::DeepTraverse
Included in:
Base
Defined in:
lib/universe_compiler/universe/compile.rb

Instance Method Summary collapse

Methods included from UniverseCompiler::Utils::DeepTraverse

#deep_map, #deep_traverse

Instance Method Details

#compile(scenario: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/universe_compiler/universe/compile.rb', line 8

def compile(scenario: nil)
  valid? raise_error: true
  UniverseCompiler.logger.info "Starting compilation of universe '#{name}'"
  # Pass 1 - Universe duplication
  target_universe = dup

  # Pass 2 - Applying entities inheritance
  target_universe.apply_entities_inheritance

  # Apply scenario
  target_universe.apply_entities_overrides scenario unless scenario.nil?

  UniverseCompiler.logger.info "Completed compilation of universe '#{name}' into '#{target_universe.name}'"
  target_universe
end