Class: Lutaml::Model::Schema::FileWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/schema/file_writer.rb

Overview

Writes a CompiledOutput to disk: per-class .rb files in a module subdirectory plus a central *_registry.rb (when a module namespace is set). Shared between XSD and RNG compilers.

The registry_generator: parameter selects which RegistryGenerator subclass to use (XSD has a 2-phase template; RNG uses the default).

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output, dir, registry_generator) ⇒ FileWriter

Returns a new instance of FileWriter.



19
20
21
22
23
# File 'lib/lutaml/model/schema/file_writer.rb', line 19

def initialize(output, dir, registry_generator)
  @output = output
  @dir = dir
  @registry_generator = registry_generator
end

Class Method Details

.write(output, dir, registry_generator: RegistryGenerator) ⇒ Object



15
16
17
# File 'lib/lutaml/model/schema/file_writer.rb', line 15

def self.write(output, dir, registry_generator: RegistryGenerator)
  new(output, dir, registry_generator).write
end

Instance Method Details

#writeObject



25
26
27
28
29
30
31
# File 'lib/lutaml/model/schema/file_writer.rb', line 25

def write
  if @output.module_namespace
    write_namespaced
  else
    write_flat
  end
end