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
-
#chord ⇒ Object
readonly
The chord seed entry the including class was built from.
Instance Method Summary collapse
-
#root ⇒ Object
The chord's root as a Theory::NoteName, parsed once and memoized.
-
#symbol ⇒ Object
The chord's symbol as spelled in the seed data, e.g.
Instance Attribute Details
#chord ⇒ Object (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
#root ⇒ Object
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 |
#symbol ⇒ Object
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 |