Class: Coltrane::Commands::FindGuitarChord

Inherits:
Command
  • Object
show all
Defined in:
lib/coltrane/commands/find_guitar_chord.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(notation) ⇒ FindGuitarChord

Returns a new instance of FindGuitarChord.



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

def initialize(notation)
  @notation = notation
end

Instance Attribute Details

#notationObject (readonly)

Returns the value of attribute notation.



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

def notation
  @notation
end

Class Method Details

.mercenary_init(program) ⇒ Object



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

def self.mercenary_init(program)
  program.command(:'find-guitar-chord') do |c|
    c.syntax 'find-guitar-chord x-2-2-4-5-x'
    c.description 'find the chord name assuming the standard tuning (EADGBE)'
    c.action do |(notation)|
      new(notation).render
    end
  end
end

Instance Method Details

#representationObject



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

def representation
  Representation::Guitar.find_chord_by_notation(notation)
end