Class: Musicality::Link::TargetedLink

Inherits:
Musicality::Link show all
Defined in:
lib/musicality/notation/model/link.rb

Direct Known Subclasses

Glissando, Portamento

Constant Summary

Constants included from Packable

Packable::PACKED_CLASS_KEY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Musicality::Link

#clone

Methods included from Packable

#class_str, included, #init_params, #pack, pack_val, recover_class, unpack_val

Constructor Details

#initialize(target_pitch) ⇒ TargetedLink

Returns a new instance of TargetedLink.



36
37
38
# File 'lib/musicality/notation/model/link.rb', line 36

def initialize target_pitch
  @target_pitch = target_pitch
end

Instance Attribute Details

#target_pitchObject

Returns the value of attribute target_pitch.



34
35
36
# File 'lib/musicality/notation/model/link.rb', line 34

def target_pitch
  @target_pitch
end

Instance Method Details

#==(other) ⇒ Object



40
41
42
# File 'lib/musicality/notation/model/link.rb', line 40

def ==(other)
  super && @target_pitch == other.target_pitch
end

#to_sObject



53
54
55
# File 'lib/musicality/notation/model/link.rb', line 53

def to_s
  super + @target_pitch.to_s
end

#transpose(diff) ⇒ Object



44
45
46
# File 'lib/musicality/notation/model/link.rb', line 44

def transpose diff
  self.clone.transpose! diff
end

#transpose!(diff) ⇒ Object



48
49
50
51
# File 'lib/musicality/notation/model/link.rb', line 48

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