Class: Stave::Theory::KeySignature
- Inherits:
-
Core::Lookup
- Object
- Core::Lookup
- Stave::Theory::KeySignature
- Defined in:
- lib/stave/theory/key_signature.rb
Defined Under Namespace
Classes: Group
Instance Attribute Summary
Attributes inherited from Core::Lookup
Class 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
Class Method Details
.parse(scale) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/stave/theory/key_signature.rb', line 32 def self.parse(scale) accidentals = scale.uniq.map(&:accidental) flat_count = accidentals.count(&:flat?) sharp_count = accidentals.count(&:sharp?) find_by(flat_count:, sharp_count:) end |