Sha256: 459cc24f3af158199dd0a183a72eb940db0721fbfc284529e7c097c7ed88861c

Contents?: true

Size: 489 Bytes

Versions: 21

Compression:

Stored size: 489 Bytes

Contents

# frozen_string_literal: true

# Module for style guidelines.
module HeadMusic::Style::Guidelines; end

# A counterpoint guideline
class HeadMusic::Style::Guidelines::EndOnTonic < HeadMusic::Style::Annotation
  MESSAGE = 'End on the first scale degree.'

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

  private

  def ends_on_tonic?
    tonic_spelling == last_note_spelling
  end

  def last_note_spelling
    last_note&.spelling
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
head_music-0.19.1 lib/head_music/style/guidelines/end_on_tonic.rb