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-3.0.0.rc1 lib/coltrane/theory/key.rb
coltrane-3.0.0.pre lib/coltrane/theory/key.rb