Sha256: fb54376a76b8a83b7e39e3b0081965e1e3a6147385e3e5a1e968ce0ba0d726dc

Contents?: true

Size: 790 Bytes

Versions: 2

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

module ColtraneInstruments
  module Guitar
    DEFAULT_TUNING = %w[E2 A2 D3 G3 B3 E4]
    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

2 entries across 2 versions & 1 rubygems

Version Path
coltrane-2.1.5 lib/coltrane_instruments/guitar/base.rb
coltrane-2.1.0 lib/coltrane_instruments/guitar/base.rb