aboutsummaryrefslogtreecommitdiffstats
path: root/lib/carlosgoce/layout/layouts.rb
blob: 65da961fa2c0bf9c989e7da13572d4be078eb135 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'rubygems'
require 'prawn'
require 'prawn/table'

module CarlosGoce
  module Layout
    class Simple
      def create (file, data, year)
        tables = []
        Prawn::Document.generate(file) do
          font_size = 16

          data.each do |k, month|
            days = data[k][:formatted_days]
            cells = (days).to_a.each_slice(7).to_a
            cells.unshift [data[k][:name]]

            tables << make_table(cells, cell_style: {align: :center, size: 7, border_width: 0})
          end

          table(
              tables.each_slice(3).to_a,
              cell_style: {align: :center, padding: [5, 5, 5, 5],
              border_width: 0}
          )
        end
      end
    end
  end
end