Class: Lutaml::Xsd::Spa::MultiFileMode
- Inherits:
-
Object
- Object
- Lutaml::Xsd::Spa::MultiFileMode
- Defined in:
- lib/lutaml/xsd/spa/output_mode.rb
Overview
Multi-file output mode
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(output_dir, verbose = false) ⇒ MultiFileMode
constructor
A new instance of MultiFileMode.
-
#write(html_content, schema_data) ⇒ Array<String>
Write multiple files with external resources.
Constructor Details
#initialize(output_dir, verbose = false) ⇒ MultiFileMode
Returns a new instance of MultiFileMode.
70 71 72 73 |
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 70 def initialize(output_dir, verbose = false) @output_dir = output_dir @verbose = verbose end |
Instance Attribute Details
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
68 69 70 |
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 68 def output_dir @output_dir end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
68 69 70 |
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 68 def verbose @verbose end |
Instance Method Details
#write(html_content, schema_data) ⇒ Array<String>
Write multiple files with external resources
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 80 def write(html_content, schema_data) # Ensure output directory structure exists FileUtils.mkdir_p(output_dir) FileUtils.mkdir_p(File.join(output_dir, "data")) FileUtils.mkdir_p(File.join(output_dir, "js")) FileUtils.mkdir_p(File.join(output_dir, "css")) written_files = [] # Write HTML file html_path = File.join(output_dir, "index.html") File.write(html_path, html_content) log "✓ Wrote: #{html_path}" written_files << html_path # Write JSON data file json_path = File.join(output_dir, "data", "schemas.json") File.write(json_path, JSON.pretty_generate(schema_data)) log "✓ Wrote: #{json_path}" written_files << json_path # NOTE: JS and CSS files would be written here in a complete implementation # For now, they're embedded in the HTML written_files end |