Class: Mxrb::Compiler::MicroflowMaterializer

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/compiler/microflow_materializer.rb

Overview

Materializes microflows, nanoflows, and rules using the version-matched Runtime schema.

Constant Summary collapse

TYPES =
%w[Microflows$Microflow Microflows$Nanoflow Microflows$Rule].freeze

Instance Method Summary collapse

Constructor Details

#initialize(mpr_path, deployment:) ⇒ MicroflowMaterializer

Returns a new instance of MicroflowMaterializer.



11
12
13
14
# File 'lib/mxrb/compiler/microflow_materializer.rb', line 11

def initialize(mpr_path, deployment:)
  @mpr_path = File.expand_path(mpr_path)
  @deployment = File.expand_path(deployment)
end

Instance Method Details

#materializeObject



16
17
18
19
20
21
22
23
24
# File 'lib/mxrb/compiler/microflow_materializer.rb', line 16

def materialize
  source = SourceModel.read(@mpr_path)
  Adapter.for(source.version)
  path = File.join(@deployment, 'model', 'model.mdp')
  package = ModelPackage.read(path)
  documents = compile_documents(source, package)
  write_model(path, package, documents)
  result(path, documents)
end