Sha256: fbd35149e5748ff241765d47ba32006db57b5c06554fb5a528723bd5081910d6

Contents?: true

Size: 673 Bytes

Versions: 21

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

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

# A counterpoint guideline
class HeadMusic::Style::Guidelines::NoUnisonsInMiddle < HeadMusic::Style::Annotation
  MESSAGE = 'Unisons may only be used in the first and last note.'

  def marks
    unison_pairs.map do |notes|
      HeadMusic::Style::Mark.for_all(notes)
    end.flatten
  end

  private

  def unison_pairs
    middle_unisons.map(&:notes).compact
  end

  def middle_unisons
    middle_intervals.select { |interval| interval.perfect_consonance? && interval.unison? }
  end

  def middle_intervals
    [harmonic_intervals[1..-2]].flatten.compact
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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