Class: Coltrane::Commands::FindProgression

Inherits:
Command
  • Object
show all
Defined in:
lib/coltrane/commands/find_progression.rb

Constant Summary

Constants inherited from Command

Command::COMMON_OPTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

add_shared_option, #custom_guitar, inherited, #render, #renderer_options, subclasses

Constructor Details

#initialize(progression_set, **options) ⇒ FindProgression

Returns a new instance of FindProgression.



6
7
8
# File 'lib/coltrane/commands/find_progression.rb', line 6

def initialize(progression_set, **options)
  @progression_set = progression_set
end

Instance Attribute Details

#progression_setObject (readonly)

Returns the value of attribute progression_set.



4
5
6
# File 'lib/coltrane/commands/find_progression.rb', line 4

def progression_set
  @progression_set
end

Class Method Details

.mercenary_init(program) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/coltrane/commands/find_progression.rb', line 14

def self.mercenary_init(program)
  program.command(:'find-progression') do |c|
    c.syntax 'find-progression <list of chords>'
    c.description 'Find progressions in scales. Ex: coltrane find-progression AM-DM-F#m-EM'
    c.action do |(chord_notation)|
      chord_notation
      .split('-')
      .yield_self { |chords| Theory::Progression.find(*chords) }
      .yield_self { |progression_set| new(progression_set).render }
    end
  end
end

Instance Method Details

#representationObject



10
11
12
# File 'lib/coltrane/commands/find_progression.rb', line 10

def representation
  progression_set
end