Class: Music::Transcription::Link::TargetedLink

Inherits:
Music::Transcription::Link show all
Defined in:
lib/music-transcription/model/link.rb

Direct Known Subclasses

Glissando, Legato, Portamento, Slur

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Music::Transcription::Link

#clone

Constructor Details

#initialize(target_pitch) ⇒ TargetedLink

Returns a new instance of TargetedLink.



35
36
37
# File 'lib/music-transcription/model/link.rb', line 35

def initialize target_pitch
  @target_pitch = target_pitch
end

Instance Attribute Details

#target_pitchObject

Returns the value of attribute target_pitch.



33
34
35
# File 'lib/music-transcription/model/link.rb', line 33

def target_pitch
  @target_pitch
end

Instance Method Details

#==(other) ⇒ Object



39
40
41
# File 'lib/music-transcription/model/link.rb', line 39

def ==(other)
  self.class == other.class && @target_pitch == other.target_pitch
end

#to_sObject



52
53
54
# File 'lib/music-transcription/model/link.rb', line 52

def to_s
  link_char + @target_pitch.to_s
end

#transpose(diff) ⇒ Object



43
44
45
# File 'lib/music-transcription/model/link.rb', line 43

def transpose diff
  self.clone.transpose! diff
end

#transpose!(diff) ⇒ Object



47
48
49
50
# File 'lib/music-transcription/model/link.rb', line 47

def transpose! diff
  @target_pitch = @target_pitch.transpose(diff)
  return self
end