Sha256: e0a42daf7a66b2a7316d4d7fc6750c0c7dc335c0c14ca630083d2d6c326c5dfb

Contents?: true

Size: 339 Bytes

Versions: 22

Compression:

Stored size: 339 Bytes

Contents

# frozen_string_literal: true

module Coltrane
  module Theory
    class Key < DiatonicScale
      KEY_REGEX = /([A-G][#b]?)([mM]?)/

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

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
coltrane-4.1.2 lib/coltrane/theory/key.rb
coltrane-4.1.1 lib/coltrane/theory/key.rb
coltrane-4.1.0 lib/coltrane/theory/key.rb
coltrane-4.0.6 lib/coltrane/theory/key.rb
coltrane-4.0.5 lib/coltrane/theory/key.rb
coltrane-4.0.4 lib/coltrane/theory/key.rb
coltrane-4.0.3 lib/coltrane/theory/key.rb
coltrane-3.4.2 lib/coltrane/theory/key.rb
coltrane-3.4.1 lib/coltrane/theory/key.rb
coltrane-3.4.0 lib/coltrane/theory/key.rb
coltrane-3.3.3 lib/coltrane/theory/key.rb
coltrane-3.3.2 lib/coltrane/theory/key.rb
coltrane-3.3.1 lib/coltrane/theory/key.rb
coltrane-3.3.0 lib/coltrane/theory/key.rb
coltrane-3.2.0 lib/coltrane/theory/key.rb
coltrane-3.1.3 lib/coltrane/theory/key.rb
coltrane-3.1.2 lib/coltrane/theory/key.rb
coltrane-3.1.1 lib/coltrane/theory/key.rb
coltrane-3.1.0 lib/coltrane/theory/key.rb
coltrane-3.0.0 lib/coltrane/theory/key.rb