Class: Igniter::Contracts::Execution::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/contracts/execution/compiler.rb

Class Method Summary collapse

Class Method Details

.compilation_report(profile:, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/igniter/contracts/execution/compiler.rb', line 12

def compilation_report(profile:, &block)
  builder = Builder.build(profile: profile, &block)
  operations = normalize(builder.operations, profile: profile)
  findings = validate(operations, profile: profile)
  validation_report = ValidationReport.new(
    operations: operations,
    findings: findings,
    profile_fingerprint: profile.fingerprint
  )
  compiled_graph = if validation_report.ok?
                     CompiledGraph.new(operations: operations,
                                       profile_fingerprint: profile.fingerprint)
                   end

  CompilationReport.new(
    operations: operations,
    validation_report: validation_report,
    compiled_graph: compiled_graph,
    profile_fingerprint: profile.fingerprint
  )
end

.compile(profile:, &block) ⇒ Object



8
9
10
# File 'lib/igniter/contracts/execution/compiler.rb', line 8

def compile(profile:, &block)
  compilation_report(profile: profile, &block).to_compiled_graph
end

.validation_report(profile:, &block) ⇒ Object



34
35
36
# File 'lib/igniter/contracts/execution/compiler.rb', line 34

def validation_report(profile:, &block)
  compilation_report(profile: profile, &block).validation_report
end