Sha256: 30d72d350428972a8c3529f811d13237912e084fb5e7a49560ce2b986d462d13

Contents?: true

Size: 987 Bytes

Versions: 5

Compression:

Stored size: 987 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
          },

          representation: nil
        })
        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

5 entries across 5 versions & 1 rubygems

Version Path
coltrane-4.1.2 lib/coltrane/ui/views/find_chords_in_scale.rb
coltrane-4.1.1 lib/coltrane/ui/views/find_chords_in_scale.rb
coltrane-4.1.0 lib/coltrane/ui/views/find_chords_in_scale.rb
coltrane-4.0.6 lib/coltrane/ui/views/find_chords_in_scale.rb
coltrane-4.0.5 lib/coltrane/ui/views/find_chords_in_scale.rb