class Dieses::Application::Sheets::Table

Constants

TABLES

Public Instance Methods

call() click to toggle source
# File lib/dieses/application/sheets/table.rb, line 25
def call # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
  row, col = TABLES[param.table].to_a

  cell_width,  total_width  = Ruler.divide(unit: param.unit, multiple: col, length: canvas.width)
  cell_height, total_height = Ruler.divide(unit: param.unit, multiple: row, length: canvas.height)

  draw unit: param.unit do
    repeat row + 1 do
      hline :hline, length: total_width
      down cell_height
    end
    repeat row do
      down cell_height / 2
      hline :half, :dashed, :fine, length: total_width
      down cell_height / 2
    end
    repeat col + 1 do
      vline :vline, length: total_height
      right cell_width
    end
  end
end