Class: HeadMusic::Style::Guidelines::ThreePerBar

Inherits:
NoteCountPerBar show all
Defined in:
lib/head_music/style/guidelines/three_per_bar.rb

Overview

Checks that each middle bar contains exactly three quarter notes.

Constant Summary collapse

MESSAGE =
"Use three quarter notes in each middle bar."
QUARTER =
HeadMusic::Rudiment::RhythmicValue.get(:quarter)

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#check_middle_bar(bar_number) ⇒ Object (private)



12
13
14
15
16
17
# File 'lib/head_music/style/guidelines/three_per_bar.rb', line 12

def check_middle_bar(bar_number)
  bar_notes = notes_in_bar(bar_number)
  return if bar_notes.length == 3 && bar_notes.all? { |note| note.rhythmic_value == QUARTER }

  mark_bar(bar_number)
end