Class: Lutaml::Xsd::Spa::SingleFileMode

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/xsd/spa/output_mode.rb

Overview

Single-file output mode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_path, verbose = false) ⇒ SingleFileMode

Returns a new instance of SingleFileMode.



37
38
39
40
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 37

def initialize(output_path, verbose = false)
  @output_path = output_path
  @verbose = verbose
end

Instance Attribute Details

#output_pathObject (readonly)

Returns the value of attribute output_path.



35
36
37
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 35

def output_path
  @output_path
end

#verboseObject (readonly)

Returns the value of attribute verbose.



35
36
37
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 35

def verbose
  @verbose
end

Instance Method Details

#write(html_content, _schema_data) ⇒ Array<String>

Write single HTML file with embedded resources

Parameters:

  • html_content (String)

    Complete HTML content

  • _schema_data (Hash)

    Schema data (unused in single mode)

Returns:

  • (Array<String>)

    List of written files



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/lutaml/xsd/spa/output_mode.rb', line 47

def write(html_content, _schema_data)
  # Ensure output directory exists
  output_dir = File.dirname(output_path)
  FileUtils.mkdir_p(output_dir)

  # Write HTML file
  File.write(output_path, html_content)
  log "✓ Wrote: #{output_path}"

  [output_path]
end