Class: Coltrane::Cli::Chord

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/chord.rb

Overview

Interfaces chord functionality with the lib

Instance Method Summary collapse

Constructor Details

#initialize(*chords, on: :text, flavor: 'intervals', notes: nil) ⇒ Chord

Returns a new instance of Chord.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cli/chord.rb', line 7

def initialize(*chords, on: :text, flavor: 'intervals', notes: nil)
  @chords =
    if !chords.empty?
      if chords[0].is_a?(String)
        chords.map { |c| Coltrane::Chord.new(name: c) }
      else
        chords
      end
    elsif !notes.nil?
      [Coltrane::Chord.new(notes: notes)]
    end

  @chords.each do |chord|
    desc = "#{chord.name} chord:"
    Coltrane::Cli::Notes.new chord.notes, on: on,
                                          desc: desc,
                                          flavor: flavor
  end
end