Class: Stave::Theory::Note::PitchClass
- Inherits:
-
Core::Lookup
- Object
- Core::Lookup
- Stave::Theory::Note::PitchClass
- Defined in:
- lib/stave/theory/note.rb
Instance Attribute Summary
Attributes inherited from Core::Lookup
Instance Method Summary collapse
Methods inherited from Core::Lookup
#==, each_key, find_by, #initialize, keys, string_keys, variant, variant?, variant_lookup, variants, where, with_options
Constructor Details
This class inherits a constructor from Stave::Core::Lookup
Instance Method Details
#+(other) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/stave/theory/note.rb', line 13 def +(other) case other when Integer then PitchClass.find_by(index: (index + other) % 7) else raise TypeError end end |
#-(other) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/stave/theory/note.rb', line 20 def -(other) case other when Integer then PitchClass.find_by(index: (index - other) % 7) else raise TypeError end end |