Parent

Files

Prawn::Document::Grid

A Grid represents the entire grid system of a Page and calculates the column width and row height of the base box.

Attributes

column_gutter[R]
columns[R]
gutter[R]
pdf[R]
row_gutter[R]
rows[R]

Public Class Methods

new(pdf, options = {}) click to toggle source

:nodoc

# File lib/prawn/layout/grid.rb, line 39
def initialize(pdf, options = {})
  valid_options = [:columns, :rows, :gutter, :row_gutter, :column_gutter]
  Prawn.verify_options valid_options, options

  @pdf = pdf
  @columns = options[:columns]
  @rows = options[:rows]
  set_gutter(options)
end

Public Instance Methods

column_width() click to toggle source

Calculates the base width of boxes.

# File lib/prawn/layout/grid.rb, line 50
def column_width
  @column_width ||= subdivide(pdf.bounds.width, columns, column_gutter)
end
row_height() click to toggle source

Calculates the base height of boxes.

# File lib/prawn/layout/grid.rb, line 55
def row_height
 @row_height ||= subdivide(pdf.bounds.height, rows, row_gutter)
end
show_all(color = "CCCCCC") click to toggle source

Diagnostic tool to show all of the grids. Defaults to gray.

# File lib/prawn/layout/grid.rb, line 60
def show_all(color = "CCCCCC")
  self.rows.times do |i|
    self.columns.times do |j|
      pdf.grid(i,j).show(color)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.