Class: Coltrane::Commands::CommonChords
- Defined in:
- lib/coltrane/commands/common_chords.rb
Constant Summary
Constants inherited from Command
Coltrane::Commands::Command::COMMON_OPTIONS
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
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/coltrane/commands/common_chords.rb', line 12 def self.mercenary_init(program) program.command(:'common-chords') do |c| c.alias(:'common-chord') add_shared_option(:flavor, c) add_shared_option(:on, c) c.syntax 'common-chords [TONE_1 SCALE_NAME_1], [TONE_2 SCALE_NAME_2], [...]' c.description 'Finds chords that are shared between the given scales' c.action do |(*scale_strings), **| scale_strings .join(' ') .split(',') .map { |scale_notation| Commands::Scale.parse(scale_notation).all_chords } .reduce(:&) .each { |chord| Commands::Chords.new(chord, **).render } end end end |