Class: HeadMusic::Rudiment::Pitch::OctaveEquivalence
- Inherits:
-
Object
- Object
- HeadMusic::Rudiment::Pitch::OctaveEquivalence
- Defined in:
- lib/head_music/rudiment/pitch/octave_equivalence.rb
Overview
Octave equivalence is the functional equivalence of pitches with the same spelling separated by one or more octaves.
Instance Attribute Summary collapse
-
#pitch ⇒ Object
readonly
Returns the value of attribute pitch.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pitch) ⇒ OctaveEquivalence
constructor
A new instance of OctaveEquivalence.
- #octave_equivalent?(other) ⇒ Boolean (also: #equivalent?)
Constructor Details
#initialize(pitch) ⇒ OctaveEquivalence
Returns a new instance of OctaveEquivalence.
10 11 12 |
# File 'lib/head_music/rudiment/pitch/octave_equivalence.rb', line 10 def initialize(pitch) @pitch = pitch end |
Instance Attribute Details
#pitch ⇒ Object (readonly)
Returns the value of attribute pitch.
8 9 10 |
# File 'lib/head_music/rudiment/pitch/octave_equivalence.rb', line 8 def pitch @pitch end |
Class Method Details
.get(pitch) ⇒ Object
3 4 5 6 |
# File 'lib/head_music/rudiment/pitch/octave_equivalence.rb', line 3 def self.get(pitch) @octave_equivalences ||= {} @octave_equivalences[pitch.to_s] ||= new(pitch) end |