Sha256: 80fc64673082bfdcc4081c1184ee4742811ee5696179a83a4ca88148392810c3

Contents?: true

Size: 682 Bytes

Versions: 18

Compression:

Stored size: 682 Bytes

Contents

# frozen_string_literal: true

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

# A counterpoint guideline
class HeadMusic::Style::Guidelines::OneToOne < HeadMusic::Style::Annotation
  MESSAGE = 'Place a note for each note in the other voice.'

  def marks
    return unless cantus_firmus&.notes
    return if cantus_firmus.notes.empty?

    HeadMusic::Style::Mark.for_each(
      notes_without_match(voice, cantus_firmus) + notes_without_match(cantus_firmus, voice)
    )
  end

  private

  def notes_without_match(voice1, voice2)
    voice1.notes.reject do |voice1_note|
      voice2.notes.map(&:position).include?(voice1_note.position)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
head_music-0.27.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.26.3 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.26.2 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.26.1 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.26.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.25.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.24.5 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.24.4 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.24.3 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.24.2 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.24.1 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.24.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.23.4 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.23.3 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.23.2 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.23.1 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.23.0 lib/head_music/style/guidelines/one_to_one.rb
head_music-0.22.0 lib/head_music/style/guidelines/one_to_one.rb