Class: HeadMusic::Style::Guidelines::NoRestsAfterNote

Inherits:
Annotation
  • Object
show all
Defined in:
lib/head_music/style/guidelines/no_rests_after_note.rb

Overview

Once the first note has sounded, no rests are permitted for the remainder of the voice. Rests before the first note (a leading rest) are allowed.

Constant Summary collapse

MESSAGE =
"Do not rest after the first note has sounded."

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from HeadMusic::Style::Annotation

Instance Method Details

#marksObject



9
10
11
12
13
# File 'lib/head_music/style/guidelines/no_rests_after_note.rb', line 9

def marks
  return [] if rests.empty? || notes.empty?

  HeadMusic::Style::Mark.for_each(rests_after_first_note)
end

#rests_after_first_noteObject (private)



17
18
19
# File 'lib/head_music/style/guidelines/no_rests_after_note.rb', line 17

def rests_after_first_note
  rests.select { |rest| rest.position >= first_note.position }
end