Class: HeadMusic::Style::Guidelines::AllowWholeHalfQuarterNotes

Inherits:
HeadMusic::Style::Guideline show all
Defined in:
lib/head_music/style/guidelines/allow_whole_half_quarter_notes.rb

Overview

Validates that counterpoint notes use only whole, half, or quarter note rhythmic values. Appropriate for counterpoint combining the first three species.

Constant Summary collapse

ALLOWED_TOTAL_VALUES =
[1.0, 0.5, 0.25].freeze

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#marksObject



9
10
11
# File 'lib/head_music/style/guidelines/allow_whole_half_quarter_notes.rb', line 9

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

#violating_notesObject (private)



15
16
17
# File 'lib/head_music/style/guidelines/allow_whole_half_quarter_notes.rb', line 15

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