class MusicalScore::Notes
Attributes
duration[R]
notes[R]
Public Class Methods
new(notes)
click to toggle source
# File lib/musical_score/notes.rb, line 10 def initialize(notes) @notes = notes end
Public Instance Methods
[](index)
click to toggle source
# File lib/musical_score/notes.rb, line 18 def [](index) return @notes[index] end
divide_to_notes_and_rests()
click to toggle source
# File lib/musical_score/notes.rb, line 13 def divide_to_notes_and_rests divided_array = @notes.partition { |note| note.rest } return { note: divided_array[1], rest: divided_array[0] } end
each() { |note| ... }
click to toggle source
# File lib/musical_score/notes.rb, line 22 def each @notes.each do |note| yield note end end
set_location(location, number)
click to toggle source
# File lib/musical_score/notes.rb, line 28 def set_location(location, number) current_location = MusicalScore::Location.new(number, location) @notes.each do |note| note.location = current_location current_location = MusicalScore::Location.new(number, current_location.location + note.actual_duration) end @duration = current_location.location - location end