Sha256: 491b55cd7cbdb5a4bed0ef1fc084464a869768c92b25dcd44c40a1689c00f73b

Contents?: true

Size: 877 Bytes

Versions: 6

Compression:

Stored size: 877 Bytes

Contents

# frozen_string_literal: true

module Coltrane
  module Cli
    # Interfaces chord functionality with the lib
    class Chord
      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|
          raise ChordNotFoundError unless chord.named?
          desc = "#{chord.name} chord:"
          Coltrane::Cli::Notes.new chord.notes, on: on,
                                                desc: desc,
                                                flavor: flavor
        end
      end
    end
  end
end

# rubocop:enable Metrics/MethodLength

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
coltrane-1.0.26 lib/cli/chord.rb
coltrane-1.0.24 lib/cli/chord.rb
coltrane-1.0.22 lib/cli/chord.rb
coltrane-1.0.21 lib/cli/chord.rb
coltrane-1.0.20 lib/cli/chord.rb
coltrane-1.0.2 lib/cli/chord.rb