Class: Musa::MusicXML::Builder::Internal::PartGroup Private
- Includes:
- Helper, Helper::HeaderToXML
- Defined in:
- lib/musa-dsl/musicxml/builder/part-group.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Part group for bracketing multiple parts together.
PartGroup represents the <part-group> element in the MusicXML part-list
section. Part groups visually bracket or brace related parts together
(e.g., string sections, choir SATB, piano grand staff).
Usage
Part groups are defined by matching start/stop pairs with the same number:
<part-group number="1" type="start">
<group-name>Strings</group-name>
<group-symbol>bracket</group-symbol>
</part-group>
<score-part id="p1">...</score-part>
<score-part id="p2">...</score-part>
<part-group number="1" type="stop" />
Nesting
Groups can be nested using different numbers:
<part-group number="1" type="start" name="Orchestra" />
<part-group number="2" type="start" name="Strings" />
<score-part id="vln1" />
<score-part id="vln2" />
<part-group number="2" type="stop" />
<part-group number="1" type="stop" />
Symbols
Common bracket symbols:
- bracket: Standard square bracket
- brace: Curly brace (for piano, organ)
- line: Simple vertical line
- square: Square bracket (rare)
Instance Attribute Summary collapse
-
#abbreviation ⇒ String?
private
Abbreviated group name.
-
#group_barline ⇒ Boolean, ...
private
Whether barlines connect across the group.
-
#group_time ⇒ Boolean, ...
private
Whether time signatures are shared.
-
#name ⇒ String?
private
Group name displayed on bracket.
-
#number ⇒ Integer?
private
Group number (for matching start/stop pairs).
-
#symbol ⇒ String?
private
Bracket symbol type.
-
#type ⇒ String
private
Type: 'start' or 'stop'.
Instance Method Summary collapse
-
#_header_to_xml(io, indent:, tabs:) ⇒ void
private
Generates the part-group XML element for the part-list section.
-
#header_to_xml(io = nil, indent: nil) ⇒ IO, StringIO
included
from Helper::HeaderToXML
private
Converts the object's header representation to MusicXML.
-
#initialize(number = nil, type:, name: nil, abbreviation: nil, symbol: nil, group_barline: nil, group_time: nil) ⇒ PartGroup
constructor
private
Creates a part group declaration.
Constructor Details
#initialize(number = nil, type:, name: nil, abbreviation: nil, symbol: nil, group_barline: nil, group_time: nil) ⇒ PartGroup
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.
Creates a part group declaration.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 84 def initialize(number = nil, # number type:, name: nil, abbreviation: nil, symbol: nil, group_barline: nil, # true group_time: nil) # true @number = number @type = type @name = name @abbreviation = abbreviation @symbol = symbol = @group_time = group_time end |
Instance Attribute Details
#abbreviation ⇒ String?
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.
Abbreviated group name.
114 115 116 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 114 def abbreviation @abbreviation end |
#group_barline ⇒ Boolean, ...
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.
Whether barlines connect across the group.
122 123 124 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 122 def end |
#group_time ⇒ Boolean, ...
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.
Whether time signatures are shared.
126 127 128 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 126 def group_time @group_time end |
#name ⇒ String?
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.
Group name displayed on bracket.
110 111 112 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 110 def name @name end |
#number ⇒ Integer?
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.
Group number (for matching start/stop pairs).
102 103 104 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 102 def number @number end |
#symbol ⇒ String?
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.
Bracket symbol type.
118 119 120 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 118 def symbol @symbol end |
#type ⇒ String
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.
Type: 'start' or 'stop'.
106 107 108 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 106 def type @type end |
Instance Method Details
#_header_to_xml(io, indent:, tabs:) ⇒ void
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.
This method returns an undefined value.
Generates the part-group XML element for the part-list section.
136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 136 def _header_to_xml(io, indent:, tabs:) io.puts "#{tabs}<part-group#{ decode_bool_or_string_attribute(@number&.to_i, 'number') } type=\"#{@type}\">" io.puts "#{tabs}\t<group-name>#{@name}</group-name>" if @name io.puts "#{tabs}\t<group-abbreviation>#{@abbreviation}</group-abbreviation>" if @abbreviation io.puts "#{tabs}\t<group-symbol>#{@symbol}</group-symbol>" if @symbol io.puts "#{tabs}\t<group-barline>#{decode_bool_or_string_value(@group_barline, 'yes', 'no')}</group-barline>" if io.puts "#{tabs}\t<group-time>#{decode_bool_or_string_value(@group_time, 'yes', 'no')}</group-time>" if @group_time io.puts "#{tabs}</part-group>" end |
#header_to_xml(io = nil, indent: nil) ⇒ IO, StringIO Originally defined in module Helper::HeaderToXML
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.