Sha256: ca188f8046cd114c4cb2c9d938ccf69fa37a3eea6c9a42e2a562e4ec0920e24b

Contents?: true

Size: 297 Bytes

Versions: 1

Compression:

Stored size: 297 Bytes

Contents

# frozen_string_literal: true

module Coltrane
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coltrane-2.2.1 lib/coltrane/key.rb