Object
A Box is a class that represents a bounded area of a page. A Grid object has methods that allow easy access to the coordinates of its corners, which can be plugged into most existing prawnmethods.
y-coordinate of the bottom
# File lib/prawn/layout/grid.rb, line 142 142: def bottom 143: @bottom ||= top - height 144: end
x,y coordinates of bottom left corner
# File lib/prawn/layout/grid.rb, line 157 157: def bottom_left 158: [left, bottom] 159: end
x,y coordinates of bottom right corner
# File lib/prawn/layout/grid.rb, line 162 162: def bottom_right 163: [right, bottom] 164: end
Creates a standard bounding box based on the grid box.
# File lib/prawn/layout/grid.rb, line 167 167: def bounding_box(&blk) 168: pdf.bounding_box(top_left, :width => width, :height => height, &blk) 169: end
Width of the gutter
# File lib/prawn/layout/grid.rb, line 122 122: def gutter 123: grid.gutter.to_f 124: end
Height of a box
# File lib/prawn/layout/grid.rb, line 117 117: def height 118: grid.row_height.to_f 119: end
x-coordinate of left side
# File lib/prawn/layout/grid.rb, line 127 127: def left 128: @left ||= (width + grid.column_gutter) * @j.to_f 129: end
Mostly diagnostic method that outputs the name of a box as col_num, row_num
# File lib/prawn/layout/grid.rb, line 102 102: def name 103: "#{@i.to_s},#{@j.to_s}" 104: end
x-coordinate of right side
# File lib/prawn/layout/grid.rb, line 132 132: def right 133: @right ||= left + width 134: end
Diagnostic method
# File lib/prawn/layout/grid.rb, line 172 172: def show(grid_color = "CCCCCC") 173: self.bounding_box do 174: original_stroke_color = pdf.stroke_color 175: 176: pdf.stroke_color = grid_color 177: pdf.text self.name 178: pdf.stroke_bounds 179: 180: pdf.stroke_color = original_stroke_color 181: end 182: end
y-coordinate of the top
# File lib/prawn/layout/grid.rb, line 137 137: def top 138: @top ||= total_height - ((height + grid.row_gutter) * @i.to_f) 139: end
x,y coordinates of top left corner
# File lib/prawn/layout/grid.rb, line 147 147: def top_left 148: [left, top] 149: end
x,y coordinates of top right corner
# File lib/prawn/layout/grid.rb, line 152 152: def top_right 153: [right, top] 154: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.