Class: WTFChord::InstrumentPitch
- Inherits:
-
Pitch
- Object
- Pitch
- WTFChord::InstrumentPitch
show all
- Defined in:
- lib/wtf_chord/instrument_pitch.rb
Instance Attribute Summary collapse
Attributes inherited from Pitch
#note, #octave
Instance Method Summary
collapse
Methods inherited from Pitch
#-, #-@, #==, #chord, #move, #to_i, #to_s, #to_str
Constructor Details
Returns a new instance of InstrumentPitch.
9
10
11
12
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 9
def initialize(note)
@original = WTFChord.note(note)
super(init_pitch)
end
|
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval.
7
8
9
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 7
def interval
@interval
end
|
#original ⇒ Object
Returns the value of attribute original.
7
8
9
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 7
def original
@original
end
|
Instance Method Details
#<=>(other) ⇒ Object
44
45
46
47
48
49
50
51
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 44
def <=> other
case other
when Integer
to_i <=> other
when InstrumentPitch
to_i <=> other.to_i
end
end
|
#code ⇒ Object
40
41
42
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 40
def code
to_i
end
|
#dead ⇒ Object
23
24
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 23
def dead
end
|
#dead? ⇒ Boolean
26
27
28
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 26
def dead?
raise NotImplementedError
end
|
#distance_to(pitch) ⇒ Object
34
35
36
37
38
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 34
def distance_to(pitch)
pos = 0
pos += 1 while (original + pos) != pitch
pos
end
|
#holded? ⇒ Boolean
30
31
32
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 30
def holded?
raise NotImplementedError
end
|
#init_pitch ⇒ Object
14
15
16
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 14
def init_pitch
@original
end
|
#initialize_dup(other) ⇒ Object
18
19
20
21
|
# File 'lib/wtf_chord/instrument_pitch.rb', line 18
def initialize_dup(other)
super
__setobj__(@original.dup)
end
|