Class: Coltrane::Commands::Progression
- Defined in:
- lib/coltrane/commands/progression.rb
Constant Summary
Constants inherited from Command
Class Method Summary collapse
Methods inherited from Command
add_shared_option, #custom_guitar, inherited, #render, #renderer_options, subclasses
Class Method Details
.mercenary_init(program) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/coltrane/commands/progression.rb', line 4 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), **| 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, **).render } end end end |