Sha256: 336c67135ff023db90164c136777cc1f510a00a7ed3edfa6948fa7aef81ca5d0

Contents?: true

Size: 1000 Bytes

Versions: 13

Compression:

Stored size: 1000 Bytes

Contents

module Coltrane
  module Commands
    class Progression < Command
      def self.mercenary_init(program)
        program.command(:progression) do |c|
          c.syntax 'progression <roman numeral notation> in <key> [--on <instrument>]'
          c.description 'Gives you chords of a progression in a key. Ex: coltrane progression I-IV-iv-V in Am --on guitar'
          add_shared_option(:flavor, c)
          add_shared_option(:on, c)
          add_shared_option(:voicings, c)
          c.action do |(prog, _, key), **options|
            prog
            .tr('-', '_')
            .yield_self { |possible_method|
              if Theory::Progression.respond_to?(possible_method)
                Theory::Progression.send(possible_method, key)
              else
                Theory::Progression.new(prog, key: key)
              end
            }
            .chords
            .each { |chord| Commands::Chords.new(chord, **options).render }
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
coltrane-3.4.2 lib/coltrane/commands/progression.rb
coltrane-3.4.1 lib/coltrane/commands/progression.rb
coltrane-3.4.0 lib/coltrane/commands/progression.rb
coltrane-3.3.3 lib/coltrane/commands/progression.rb
coltrane-3.3.2 lib/coltrane/commands/progression.rb
coltrane-3.3.1 lib/coltrane/commands/progression.rb
coltrane-3.3.0 lib/coltrane/commands/progression.rb
coltrane-3.2.0 lib/coltrane/commands/progression.rb
coltrane-3.1.3 lib/coltrane/commands/progression.rb
coltrane-3.1.2 lib/coltrane/commands/progression.rb
coltrane-3.1.1 lib/coltrane/commands/progression.rb
coltrane-3.1.0 lib/coltrane/commands/progression.rb
coltrane-3.0.0 lib/coltrane/commands/progression.rb