Sha256: aef644638fe70ff58f634bd46031dc5adb4ed043ad432573db77efeda8e7c2b1

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 Bytes

Contents

class HeadMusic::Style::Annotation
  attr_reader :voice

  delegate(
    :composition,
    :highest_notes,
    :lowest_notes,
    :melodic_intervals,
    :notes,
    :notes_not_in_key,
    :placements,
    :range,
    :rests,
    to: :voice
  )

  def initialize(voice)
    @voice = voice
  end

  def fitness
    [marks].flatten.compact.map(&:fitness).reduce(1, :*)
  end

  def perfect?
    fitness == 1
  end

  def start_position
    [marks].flatten.compact.map(&:start_position).sort.first
  end

  def end_position
    [marks].flatten.compact.map(&:end_position).sort.last
  end

  def marks
    raise NotImplementedError
  end

  def message
    raise NotImplementedError
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
head_music-0.11.9 lib/head_music/style/annotation.rb
head_music-0.11.8 lib/head_music/style/annotation.rb