Sha256: 3f6aa3735b186890ba5a5eb5870283da80cc42294b0c6db32dba3e23d52b114f

Contents?: true

Size: 745 Bytes

Versions: 2

Compression:

Stored size: 745 Bytes

Contents

module Music
module Transcription

# Connect one note pitch to the target pitch of the next note, via slur, legato, etc.
#
# @!attribute [rw] target_pitch
#   @return [Pitch] The pitch of the note which is being connected to.
#
class Link
  attr_accessor :target_pitch
  
  def initialize target_pitch
    @target_pitch = target_pitch
  end

  def ==(other)
    self.class == other.class && self.target_pitch == other.target_pitch
  end
  
  def clone
    self.class.new @target_pitch.clone
  end
  
  [ :Slur,
    :Legato,
    :Glissando,
    :Portamento,
  ].each do |name|
    klass = Class.new(Link) do
      def initialize target_pitch
        super(target_pitch)
      end
    end
    Link.const_set(name.to_sym, klass)
  end
end

end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
music-transcription-0.8.1 lib/music-transcription/link.rb
music-transcription-0.8.0 lib/music-transcription/link.rb