Sha256: 5314c680868c980c6d9536001d12c86ed55698e721c00f680b38ec3df5a7c1e0

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

module HeadMusic::Style::Annotations
end

class HeadMusic::Style::Annotations::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

3 entries across 3 versions & 1 rubygems

Version Path
head_music-0.17.0 lib/head_music/style/annotations/approach_perfection_contrarily.rb
head_music-0.16.2 lib/head_music/style/annotations/approach_perfection_contrarily.rb
head_music-0.16.0 lib/head_music/style/annotations/approach_perfection_contrarily.rb