Module: OutroRails::VoicingSeedWriter

Included in:
GuitarVoicingGenerator, VoicingStubGenerator
Defined in:
lib/outro_rails/generators/voicing_seed_writer.rb

Overview

Shared behavior for generators that write chord-voicing seed YAML from a chord entry (a hash loaded from db/seeds/chords/*.yml): the chord readers, the slash-symbol rule, and the entry envelope every voicing shares. Including classes set @chord and supply the instrument-specific display_data lines.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#chordObject (readonly)

The chord seed entry the including class was built from



13
14
15
# File 'lib/outro_rails/generators/voicing_seed_writer.rb', line 13

def chord
  @chord
end

Instance Method Details

#rootObject

The chord's root as a Theory::NoteName, parsed once and memoized



21
22
23
# File 'lib/outro_rails/generators/voicing_seed_writer.rb', line 21

def root
  @root ||= Theory::NoteName.parse(chord.fetch("root_name"))
end

#symbolObject

The chord's symbol as spelled in the seed data, e.g. "Cmaj7"



16
17
18
# File 'lib/outro_rails/generators/voicing_seed_writer.rb', line 16

def symbol
  chord.fetch("symbol")
end