Class: Prawn::Document::Grid
- Inherits:
 - 
      Object
      
        
- Object
 - Prawn::Document::Grid
 
 
- Defined in:
 - lib/prawn/grid.rb
 
Overview
A Grid represents the entire grid system of a Page and calculates the column width and row height of the base box.
Experimental API collapse
- 
  
    
      #column_gutter  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute column_gutter.
 - 
  
    
      #columns  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute columns.
 - 
  
    
      #gutter  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute gutter.
 - 
  
    
      #pdf  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute pdf.
 - 
  
    
      #row_gutter  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute row_gutter.
 - 
  
    
      #rows  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute rows.
 
Experimental API collapse
- 
  
    
      #column_width  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Calculates the base width of boxes.
 - 
  
    
      #initialize(pdf, options = {})  ⇒ Grid 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
:nodoc:.
 - 
  
    
      #row_height  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Calculates the base height of boxes.
 - 
  
    
      #show_all(color = 'CCCCCC')  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Diagnostic tool to show all of the grids.
 
Constructor Details
Instance Attribute Details
#column_gutter ⇒ Object (readonly)
Returns the value of attribute column_gutter.
      58 59 60  | 
    
      # File 'lib/prawn/grid.rb', line 58 def column_gutter @column_gutter end  | 
  
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
      58 59 60  | 
    
      # File 'lib/prawn/grid.rb', line 58 def columns @columns end  | 
  
#gutter ⇒ Object (readonly)
Returns the value of attribute gutter.
      58 59 60  | 
    
      # File 'lib/prawn/grid.rb', line 58 def gutter @gutter end  | 
  
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
      58 59 60  | 
    
      # File 'lib/prawn/grid.rb', line 58 def pdf @pdf end  | 
  
#row_gutter ⇒ Object (readonly)
Returns the value of attribute row_gutter.
      58 59 60  | 
    
      # File 'lib/prawn/grid.rb', line 58 def row_gutter @row_gutter end  | 
  
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
      58 59 60  | 
    
      # File 'lib/prawn/grid.rb', line 58 def rows @rows end  | 
  
Instance Method Details
#column_width ⇒ Object
Calculates the base width of boxes.
      71 72 73  | 
    
      # File 'lib/prawn/grid.rb', line 71 def column_width @column_width ||= subdivide(pdf.bounds.width, columns, column_gutter) end  | 
  
#row_height ⇒ Object
Calculates the base height of boxes.
      76 77 78  | 
    
      # File 'lib/prawn/grid.rb', line 76 def row_height @row_height ||= subdivide(pdf.bounds.height, rows, row_gutter) end  | 
  
#show_all(color = 'CCCCCC') ⇒ Object
Diagnostic tool to show all of the grids. Defaults to gray.
      81 82 83 84 85 86 87  | 
    
      # File 'lib/prawn/grid.rb', line 81 def show_all(color = 'CCCCCC') rows.times do |row| columns.times do |column| pdf.grid(row, column).show(color) end end end  |