Class: Suma::SchemaCompiler
- Inherits:
-
Object
- Object
- Suma::SchemaCompiler
- Defined in:
- lib/suma/schema_compiler.rb
Overview
Orchestrates the compilation of a single EXPRESS schema into HTML/XML via Metanorma.
SchemaCompiler owns all file I/O and the Metanorma::Compile invocation for one schema; the rendered AsciiDoc body is supplied by a SchemaTemplate that the caller injects. This split means templates can be tested as pure functions and the compiler can be tested with a real adoc fixture, without either depending on the other.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #compile ⇒ Object
- #extensions ⇒ Object
-
#initialize(schema:, output_path:, template:) ⇒ SchemaCompiler
constructor
A new instance of SchemaCompiler.
- #output_xml_path ⇒ Object
Constructor Details
#initialize(schema:, output_path:, template:) ⇒ SchemaCompiler
Returns a new instance of SchemaCompiler.
18 19 20 21 22 23 |
# File 'lib/suma/schema_compiler.rb', line 18 def initialize(schema:, output_path:, template:) @schema = schema @id = schema.id @output_path = output_path @template = template end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
16 17 18 |
# File 'lib/suma/schema_compiler.rb', line 16 def id @id end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
16 17 18 |
# File 'lib/suma/schema_compiler.rb', line 16 def output_path @output_path end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
16 17 18 |
# File 'lib/suma/schema_compiler.rb', line 16 def schema @schema end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
16 17 18 |
# File 'lib/suma/schema_compiler.rb', line 16 def template @template end |
Instance Method Details
#compile ⇒ Object
25 26 27 28 29 30 |
# File 'lib/suma/schema_compiler.rb', line 25 def compile save_config save_adoc self end |
#extensions ⇒ Object
36 37 38 |
# File 'lib/suma/schema_compiler.rb', line 36 def extensions template.extensions end |
#output_xml_path ⇒ Object
32 33 34 |
# File 'lib/suma/schema_compiler.rb', line 32 def output_xml_path filename_adoc("xml") end |