Sha256: d91d320c09c166bbf53b4ab2dd5619d5d3f8125e56b249e2881f2132da786497

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true

module ColtraneInstruments
  module Guitar
    DEFAULT_TUNING = %w[E2 A2 D3 G3 B3 E4].freeze
    DEFAULT_FRETS = 23
    # A base class for operations involving Guitars
    class Base
      attr_reader :strings, :frets

      def self.find_chords(target_chord)
        unless target_chord.is_a?(Coltrane::Chord)
          target_chord = Coltrane::Chord.new(name: target_chord)
        end

        ColtraneInstruments::Guitar::Chord.new(target_chord, guitar: new)
                                          .fetch_descendant_chords
      end

      def initialize(tuning = DEFAULT_TUNING, frets = DEFAULT_FRETS)
        @strings = tuning.map do |p|
          String.new(Coltrane::Pitch[p], guitar: self)
        end

        @frets = frets
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coltrane-2.2.1 lib/coltrane_instruments/guitar/base.rb