Class: HeadMusic::Style::Guidelines::EndOnTonic

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

Overview

A counterpoint guideline

Constant Summary collapse

MESSAGE =
"End on the first scale degree."

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#ends_on_tonic?Boolean (private)

Returns:

  • (Boolean)


14
15
16
# File 'lib/head_music/style/guidelines/end_on_tonic.rb', line 14

def ends_on_tonic?
  tonic_spelling == last_note_spelling
end

#last_note_spellingObject (private)



18
19
20
# File 'lib/head_music/style/guidelines/end_on_tonic.rb', line 18

def last_note_spelling
  last_note&.spelling
end

#marksObject



8
9
10
# File 'lib/head_music/style/guidelines/end_on_tonic.rb', line 8

def marks
  HeadMusic::Style::Mark.for(last_note) if notes.any? && !ends_on_tonic?
end