Class: Coltrane::Renderers::TextRenderer::TheoryProgressionSetDrawer

Inherits:
BaseDrawer
  • Object
show all
Defined in:
lib/coltrane/renderers/text_renderer/theory_progression_set_drawer.rb

Instance Attribute Summary

Attributes inherited from BaseDrawer

#flavor, #layout, #model, #options, #per_row

Instance Method Summary collapse

Methods inherited from BaseDrawer

#initialize

Constructor Details

This class inherits a constructor from Coltrane::Renderers::TextRenderer::BaseDrawer

Instance Method Details

#notation_widthObject



15
16
17
18
# File 'lib/coltrane/renderers/text_renderer/theory_progression_set_drawer.rb', line 15

def notation_width
  @notation_width ||=
    progression_set.map(&:notation).map(&:size).max
end

#renderObject



7
8
9
10
11
12
13
# File 'lib/coltrane/renderers/text_renderer/theory_progression_set_drawer.rb', line 7

def render
  progression_set.map do |progression|
    "#{progression.notation.ljust(notation_width + 1, ' ')} in " \
    "#{progression.scale} (#{progression.notes_out.size} notes out)"
  end
  .join("\n")
end