Module: Musa::MusicXML::Builder::Internal::Helper::HeaderToXML Private

Included in:
Part, PartGroup
Defined in:
lib/musa-dsl/musicxml/builder/helper.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Mixin for XML header serialization (used in part-list).

Similar to ToXML, but for elements that appear in the <part-list> section of MusicXML (parts and part groups).

Classes including this module must implement _header_to_xml(io, indent:, tabs:).

Instance Method Summary collapse

Instance Method Details

#header_to_xml(io = nil, indent: nil) ⇒ IO, StringIO

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts the object's header representation to MusicXML.

Used for elements that appear in the <part-list> section, such as <score-part> and <part-group> declarations.

Parameters:

  • io (IO, StringIO, nil) (defaults to: nil)

    output stream (creates StringIO if nil)

  • indent (Integer, nil) (defaults to: nil)

    indentation level (default: 0)

Returns:

  • (IO, StringIO)

    the io parameter, containing the XML output



201
202
203
204
205
206
207
208
209
210
# File 'lib/musa-dsl/musicxml/builder/helper.rb', line 201

def header_to_xml(io = nil, indent: nil)
  io ||= StringIO.new
  indent ||= 0

  tabs = "\t" * indent

  _header_to_xml(io, indent: indent, tabs: tabs)

  io
end