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

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

Overview

A counterpoint guideline

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#ends_on_tonic?Boolean (private)

Returns:

  • (Boolean)


12
13
14
# File 'lib/head_music/style/guidelines/end_on_tonic.rb', line 12

def ends_on_tonic?
  tonic_spelling == last_note_spelling
end

#last_note_spellingObject (private)



16
17
18
# File 'lib/head_music/style/guidelines/end_on_tonic.rb', line 16

def last_note_spelling
  last_note&.spelling
end

#marksObject



6
7
8
# File 'lib/head_music/style/guidelines/end_on_tonic.rb', line 6

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