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.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 94 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_barline = @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.
124 125 126 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 124 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.
132 133 134 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 132 def @group_barline 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.
136 137 138 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 136 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.
120 121 122 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 120 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).
112 113 114 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 112 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.
128 129 130 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 128 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'.
116 117 118 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 116 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.
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 146 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 @group_barline 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.