Sha256: 37abdd991bf5aaed670730b53aa8b95b51a2c3ad2703dbf6fd391a20be770bf5

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

module Coltrane
  module UI
    module Views
      class FindCommonChordsInScales < BaseView
        questions({
          first_scale: {
            statement: 'Choose the first scale',
            options: Commands::AvailableClassicScales.run
          },

          first_scale_root: {
            statement: 'Type the tone (note)'
          },

          second_scale: {
            statement: 'Choose the second scale',
            options: Commands::AvailableClassicScales.run
          },

          second_scale_root: {
            statement: 'Type the tone (note)'
          },

          representation: {
            statement: 'How do you wanna see the results?',
            options: Commands::AvailableChordRepresentations.run
          }
        })

        def render
          scale_a    = Commands::GetClassicScale.run(*params.values_at(:first_scale, :first_scale_root))
          scale_b    = Commands::GetClassicScale.run(*params.values_at(:second_scale, :second_scale_root))
          chords     = Commands::FindCommonChords.run(scale_a, scale_b)
          rep_chords = Commands::GetRepresentationChords.run(params[:representation], chords)
          { "Chords that exist in #{scale_a.full_name} and #{scale_b.full_name}" => rep_chords }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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