Class: Coltrane::Commands::Command
- Inherits:
-
Object
- Object
- Coltrane::Commands::Command
show all
- Defined in:
- lib/coltrane/commands/command.rb
Constant Summary
collapse
- COMMON_OPTIONS =
{
on: [
'--on <INSTRUMENT>',
'Shows the notes on the given instrument/representation type. ' \
'Can be text, piano, guitar, ukulele, bass.' \
'You can also provide a custom guitar using the following format:' \
'--on custom_guitar=D2-A3-D3-B3-C3'
],
flavor: [
'--flavor <FLAVOR>',
'Chooses which additional information to display: ' \
'marks, notes, intervals or degrees'
],
voicings: [
'--voicings <NUMBER>',
'Number of voicings for guitar like instruments. Default is 6' \
'provided they are separated by dashes'
]
}
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.add_shared_option(option_name, mercenary_command) ⇒ Object
56
57
58
|
# File 'lib/coltrane/commands/command.rb', line 56
def add_shared_option(option_name, mercenary_command)
mercenary_command.option(option_name, *COMMON_OPTIONS[option_name])
end
|
.inherited(base) ⇒ Object
51
52
53
54
|
# File 'lib/coltrane/commands/command.rb', line 51
def inherited(base)
subclasses << base
super(base)
end
|
.subclasses ⇒ Object
47
48
49
|
# File 'lib/coltrane/commands/command.rb', line 47
def subclasses
@subclasses ||= []
end
|
Instance Method Details
#custom_guitar ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/coltrane/commands/command.rb', line 26
def custom_guitar
on
.to_s
.split('=')
.fetch(1)
.split('-')
.yield_self { |tuning| Representation::Guitar.new(tuning: tuning) }
end
|
#render ⇒ Object
35
36
37
38
39
|
# File 'lib/coltrane/commands/command.rb', line 35
def render
puts "\n" + Renderers::TextRenderer.render(
representation, **renderer_options
)
end
|
#renderer_options ⇒ Object
41
42
43
|
# File 'lib/coltrane/commands/command.rb', line 41
def renderer_options
{}
end
|