Class: Coltrane::Theory::Key

Inherits:
DiatonicScale show all
Defined in:
lib/coltrane/theory/key.rb

Constant Summary collapse

KEY_REGEX =
/([A-G][#b]?)([mM]?)/

Constants included from ClassicScales

ClassicScales::SCALES

Instance Attribute Summary

Attributes inherited from Scale

#interval_sequence, #tone

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DiatonicScale

#major?, #minor?, #name, #relative, #relative_major, #relative_minor

Methods inherited from Scale

#&, #==, #chords, #degree, #degree_of_chord, #degree_of_note, #degrees, #id, #include_notes?, #interval, #name, #notes, #pentads, #pretty_name, #progression, #sevenths, #size, #tertians, #triads

Methods included from ClassicScales

#fetch, #having_chords, #having_notes, #known_scales, #major, #minor, #standard_scales

Constructor Details

#initialize(notation) ⇒ Key

Returns a new instance of Key.



8
9
10
11
# File 'lib/coltrane/theory/key.rb', line 8

def initialize(notation)
  _, note, s = *notation.match(KEY_REGEX)
  super(note, major: s != 'm')
end

Class Method Details

.[](notation) ⇒ Object



13
14
15
# File 'lib/coltrane/theory/key.rb', line 13

def self.[](notation)
  new(notation)
end