Class: Musa::MusicXML::Builder::Internal::Metronome

Inherits:
DirectionType
  • Object
show all
Includes:
Helper
Defined in:
lib/musa-dsl/musicxml/builder/direction.rb

Instance Method Summary collapse

Methods included from Extension::AttributeBuilder

#attr_complex_adder_to_array, #attr_complex_adder_to_custom, #attr_complex_builder, #attr_simple_builder, #attr_tuple_adder_to_array, #attr_tuple_adder_to_hash, #attr_tuple_builder

Methods included from Helper::ToXML

#to_xml

Methods included from Extension::With

#with

Constructor Details

#initialize(beat_unit:, beat_unit_dots: nil, per_minute:, &block) ⇒ Metronome

TODO complete Metronome complexity!



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/musa-dsl/musicxml/builder/direction.rb', line 95

def initialize(beat_unit:, # quarter / eighth / ...
               beat_unit_dots: nil, # number
               per_minute:, #string
               &block)

  @beat_unit = beat_unit
  @beat_unit_dots = beat_unit_dots
  @per_minute = per_minute

  super
end

Instance Method Details

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



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/musa-dsl/musicxml/builder/direction.rb', line 111

def _direction_type_to_xml(io, indent:, tabs:)
  io.puts "#{tabs}<metronome>"

  io.puts "#{tabs}\t<beat-unit>#{@beat_unit}</beat-unit>"
  @beat_unit_dots&.times do
    io.puts "#{tabs}\t<beat-unit-dot />"
  end
  io.puts "#{tabs}\t<per-minute>#{@per_minute}</per-minute>"

  io.puts "#{tabs}</metronome>"
end