Sha256: b730dd4762cc36e3af1a64987710e1991284110958860fd464cd4f0c8cf17822

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

require 'coltrane/ui/views/show_scale'

module Coltrane
  module UI
    module Views
      class FindChordsInScale < ShowScale
        questions({
          chord_type: {
            statement: 'Which kind of chords?',
            options: ['tertian', 'all']
          },

          chord_size: {
            statement: 'What is the size of the chords',
            options: (3..7).to_a.map(&:to_s)
          },

          chord_representation: {
            statement: 'How do you wanna see this',
            options: Commands::AvailableChordRepresentations.run
          }
        })
        def render
          scale = Commands::GetClassicScale.run(*params.values_at(:scale, :tone))
          chords = Commands::GetChordsFromScale.run(
            scale,
            *params.values_at(:chord_type, :chord_size)
          )
          Commands::GetRepresentationChords.run(params[:chord_representation], chords)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coltrane-4.0.4 lib/coltrane/ui/views/find_chords_in_scale.rb
coltrane-4.0.3 lib/coltrane/ui/views/find_chords_in_scale.rb