Class: Musa::MusicXML::Builder::Internal::TimeModification

Inherits:
Object
  • Object
show all
Includes:
Helper, ToXML
Defined in:
lib/musa-dsl/musicxml/builder/note-complexities.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actual_notes:, normal_notes:, normal_type: nil, normal_dots: nil) ⇒ TimeModification

number



11
12
13
14
15
16
17
18
19
20
# File 'lib/musa-dsl/musicxml/builder/note-complexities.rb', line 11

def initialize(actual_notes:, # number
               normal_notes:, # number
               normal_type: nil, # quarter / ...
               normal_dots: nil) # number

  @actual_notes = actual_notes
  @normal_notes = normal_notes
  @normal_type = normal_type
  @normal_dots = normal_dots
end

Instance Attribute Details

#actual_notesObject

Returns the value of attribute actual_notes.



22
23
24
# File 'lib/musa-dsl/musicxml/builder/note-complexities.rb', line 22

def actual_notes
  @actual_notes
end

#normal_dotsObject

Returns the value of attribute normal_dots.



22
23
24
# File 'lib/musa-dsl/musicxml/builder/note-complexities.rb', line 22

def normal_dots
  @normal_dots
end

#normal_notesObject

Returns the value of attribute normal_notes.



22
23
24
# File 'lib/musa-dsl/musicxml/builder/note-complexities.rb', line 22

def normal_notes
  @normal_notes
end

#normal_typeObject

Returns the value of attribute normal_type.



22
23
24
# File 'lib/musa-dsl/musicxml/builder/note-complexities.rb', line 22

def normal_type
  @normal_type
end

Instance Method Details

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



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/musa-dsl/musicxml/builder/note-complexities.rb', line 24

def _to_xml(io, indent:, tabs:)
  io.puts "#{tabs}<time-modification>"

  io.puts "#{tabs}\t<actual-notes>#{@actual_notes.to_i}</actual-notes>"
  io.puts "#{tabs}\t<normal-notes>#{@normal_notes.to_i}</normal-notes>"
  io.puts "#{tabs}\t<normal-type>#{@normal_type}</normal-type>" if @normal_type
  @normal_dots&.times do
    io.puts "#{tabs}\t<normal-dot />"
  end

  io.puts "#{tabs}</time-modification>"
end