Class: Webern::Formatters::PdfFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/webern/formatters/pdf_formatter.rb

Constant Summary

Constants inherited from BaseFormatter

BaseFormatter::DEFAULT_OPTS, BaseFormatter::PITCH_CLASSES

Instance Method Summary collapse

Methods inherited from BaseFormatter

#initialize, #pitch_value

Constructor Details

This class inherits a constructor from Webern::Formatters::BaseFormatter

Instance Method Details

#write_to_fileObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/webern/formatters/pdf_formatter.rb', line 6

def write_to_file
  data = @prime_row.inversion.map do |i| 
    @prime_row.transpose(i).map do |n| 
      pitch_value(n)
    end
  end
  Prawn::Document.generate("#{@filepath}.pdf") do |pdf|
    pdf.table data, cell_style: { width: 42, height: 42, align: :center, padding: 10}
  end
end