Sha256: b739e22bb8ebf364f1bdf2a10f1fbeafde2802fafe654051b720f36b09d0c4fc

Contents?: true

Size: 960 Bytes

Versions: 1

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

module Coltrane
  module Cli
    # Interfaces chord functionality with the lib
    class Chord
      def initialize(*chords, notes: nil)
        Cli.config do |c|
          if c.on == :guitar
            c.on = :guitar_chords
          elsif c.on == :guitar_arm
            c.on = :guitar
          end
        end

        @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

        raise BadChordError unless @chords

        @chords.each do |chord|
          desc = "#{chord.name} chord:"
          Coltrane::Cli::Notes.new chord.notes, desc: desc
          # ColtraneSynth::Base.play(chord, 1) if Cli.config.sound
        end
      end
    end
  end
end

# rubocop:enable Metrics/MethodLength

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coltrane-2.2.1 lib/cli/chord.rb