Class: Mxrb::Compiler::ConstantsMaterializer
- Inherits:
-
Object
- Object
- Mxrb::Compiler::ConstantsMaterializer
- Defined in:
- lib/mxrb/compiler/constants_materializer.rb
Overview
Compiles MPR constants into Runtime model and metadata representations.
Constant Summary collapse
- DATA_TYPES =
{ 'DataTypes$StringType' => 'String', 'DataTypes$IntegerType' => 'Integer', 'DataTypes$BooleanType' => 'Boolean', 'DataTypes$DecimalType' => 'Decimal', 'DataTypes$DateTimeType' => 'DateTime' }.freeze
Instance Method Summary collapse
-
#initialize(mpr_path, deployment:) ⇒ ConstantsMaterializer
constructor
A new instance of ConstantsMaterializer.
- #materialize ⇒ Object
Constructor Details
#initialize(mpr_path, deployment:) ⇒ ConstantsMaterializer
Returns a new instance of ConstantsMaterializer.
19 20 21 22 |
# File 'lib/mxrb/compiler/constants_materializer.rb', line 19 def initialize(mpr_path, deployment:) @mpr_path = File.(mpr_path) @deployment = File.(deployment) end |
Instance Method Details
#materialize ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mxrb/compiler/constants_materializer.rb', line 24 def materialize source = SourceModel.read(@mpr_path) constants = compile(source) model_path = File.join(@deployment, 'model', 'model.mdp') = File.join(@deployment, 'model', 'metadata.json') write_model(model_path, constants) = (, constants) ConstantsMaterialization.new( model_path:, metadata_path:, constants: .freeze ) end |