Class: Mxrb::RubyApp::Synchronizer

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

Overview

Applies the reversible Ruby domain contract to a generated MPR. Anything outside this contract remains in the native sidecar and is never dropped.

Instance Method Summary collapse

Constructor Details

#initialize(root, target, manifest: Manifest.load(root)) ⇒ Synchronizer

Returns a new instance of Synchronizer.



854
855
856
857
858
# File 'lib/mxrb/ruby_app.rb', line 854

def initialize(root, target, manifest: Manifest.load(root))
  @root = File.expand_path(root)
  @target = File.expand_path(target)
  @manifest = manifest
end

Instance Method Details

#synchronize!Object



860
861
862
863
864
865
866
867
868
869
870
871
# File 'lib/mxrb/ruby_app.rb', line 860

def synchronize!
  Registry.reset!
  RubyApp.application_files(@root).each { load _1, true }
  project = Model::Project.open(@target, readonly: false)
  synchronize_entities(project)
  project.close
  project = nil
  embed_sources!
  @target
ensure
  project&.close
end