Class: HeadMusic::Style::Guidelines::AllowedRhythmicValuesForCombined123

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

Overview

Validates that counterpoint notes use only whole, half, or quarter note rhythmic values. Appropriate for combined first, second, and third species counterpoint.

Constant Summary collapse

MESSAGE =
"Use only whole notes, half notes, and quarter notes."
ALLOWED_TOTAL_VALUES =
[1.0, 0.5, 0.25].freeze

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#marksObject



11
12
13
# File 'lib/head_music/style/guidelines/allowed_rhythmic_values_for_combined123.rb', line 11

def marks
  violating_notes.map { |note| HeadMusic::Style::Mark.for(note) }
end

#violating_notesObject (private)



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

def violating_notes
  notes.reject { |note| ALLOWED_TOTAL_VALUES.include?(note.rhythmic_value.total_value) }
end