Sha256: 6f9e90cb3c10654b882396eb7d106d1b397a062d61ad52c33642a9fad8cd91ed

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 Bytes

Contents

# frozen_string_literal: true

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

# A counterpoint guideline
class HeadMusic::Style::Guidelines::ApproachPerfectionContrarily < HeadMusic::Style::Annotation
  MESSAGE = 'Approach perfect consonances by contrary motion.'

  def marks
    motions_to_perfect_consonance_approached_directly.map do |bad_motion|
      HeadMusic::Style::Mark.for_all(bad_motion.notes)
    end
  end

  private

  def motions_to_perfect_consonance_approached_directly
    motions_to_perfect_consonance.select(&:direct?)
  end

  def motions_to_perfect_consonance
    motions.select do |motion|
      motion.second_harmonic_interval.perfect_consonance?
    end
  end

  # Side effect is that you can't enter a perfect consonance by skip,
  # which is a rule.
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
head_music-0.22.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.20.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.19.2 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.19.1 lib/head_music/style/guidelines/approach_perfection_contrarily.rb