lib/coltrane_instruments/guitar/base.rb in coltrane-2.0.0 vs lib/coltrane_instruments/guitar/base.rb in coltrane-2.1.0

- old
+ new

@@ -1,14 +1,29 @@ # 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 - def initialize; end + attr_reader :strings, :frets - def find_chord(target_chord) - Chord.new(target_chord, guitar: self).fetch_descendant_chords + 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