Class: ColtraneInstruments::Guitar::Base
- Inherits:
-
Object
- Object
- ColtraneInstruments::Guitar::Base
- Defined in:
- lib/coltrane_instruments/guitar/base.rb
Overview
A base class for operations involving Guitars
Instance Attribute Summary collapse
-
#frets ⇒ Object
readonly
Returns the value of attribute frets.
-
#strings ⇒ Object
readonly
Returns the value of attribute strings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tuning = DEFAULT_TUNING, frets = DEFAULT_FRETS) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(tuning = DEFAULT_TUNING, frets = DEFAULT_FRETS) ⇒ Base
Returns a new instance of Base.
20 21 22 23 24 25 26 |
# File 'lib/coltrane_instruments/guitar/base.rb', line 20 def initialize(tuning = DEFAULT_TUNING, frets = DEFAULT_FRETS) @strings = tuning.map do |p| String.new(Coltrane::Pitch[p], guitar: self) end @frets = frets end |
Instance Attribute Details
#frets ⇒ Object (readonly)
Returns the value of attribute frets.
9 10 11 |
# File 'lib/coltrane_instruments/guitar/base.rb', line 9 def frets @frets end |
#strings ⇒ Object (readonly)
Returns the value of attribute strings.
9 10 11 |
# File 'lib/coltrane_instruments/guitar/base.rb', line 9 def strings @strings end |
Class Method Details
.find_chords(target_chord) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/coltrane_instruments/guitar/base.rb', line 11 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 |