Class: Musa::MusicXML::Builder::Internal::PartGroup

Inherits:
Object
  • Object
show all
Includes:
Helper, Helper::HeaderToXML
Defined in:
lib/musa-dsl/musicxml/builder/part-group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::HeaderToXML

#header_to_xml

Constructor Details

#initialize(number = nil, type:, name: nil, abbreviation: nil, symbol: nil, group_barline: nil, group_time: nil) ⇒ PartGroup

number



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 11

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_barline
  @group_time = group_time
end

Instance Attribute Details

#abbreviationObject

Returns the value of attribute abbreviation.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def abbreviation
  @abbreviation
end

#group_barlineObject

Returns the value of attribute group_barline.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def group_barline
  @group_barline
end

#group_timeObject

Returns the value of attribute group_time.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def group_time
  @group_time
end

#nameObject

Returns the value of attribute name.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def name
  @name
end

#numberObject

Returns the value of attribute number.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def number
  @number
end

#symbolObject

Returns the value of attribute symbol.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def symbol
  @symbol
end

#typeObject

Returns the value of attribute type.



27
28
29
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 27

def type
  @type
end

Instance Method Details

#_header_to_xml(io, indent:, tabs:) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/musa-dsl/musicxml/builder/part-group.rb', line 29

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