Parent

Files

Prawn::Document::Box

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.

Attributes

pdf[R]

Public Class Methods

new(pdf, i, j) click to toggle source
    # File lib/prawn/layout/grid.rb, line 93
93:       def initialize(pdf, i, j)
94:         @pdf = pdf
95:         @i = i
96:         @j = j
97:       end

Public Instance Methods

bottom() click to toggle source

y-coordinate of the bottom

     # File lib/prawn/layout/grid.rb, line 142
142:       def bottom
143:         @bottom ||= top - height
144:       end
bottom_left() click to toggle source

x,y coordinates of bottom left corner

     # File lib/prawn/layout/grid.rb, line 157
157:       def bottom_left
158:         [left, bottom]
159:       end
bottom_right() click to toggle source

x,y coordinates of bottom right corner

     # File lib/prawn/layout/grid.rb, line 162
162:       def bottom_right
163:         [right, bottom]
164:       end
bounding_box(&blk) click to toggle source

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
gutter() click to toggle source

Width of the gutter

     # File lib/prawn/layout/grid.rb, line 122
122:       def gutter
123:         grid.gutter.to_f
124:       end
height() click to toggle source

Height of a box

     # File lib/prawn/layout/grid.rb, line 117
117:       def height
118:         grid.row_height.to_f
119:       end
left() click to toggle source

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
name() click to toggle source

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
right() click to toggle source

x-coordinate of right side

     # File lib/prawn/layout/grid.rb, line 132
132:       def right
133:         @right ||= left + width
134:       end
show(grid_color = "CCCCCC") click to toggle source

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
top() click to toggle source

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
top_left() click to toggle source

x,y coordinates of top left corner

     # File lib/prawn/layout/grid.rb, line 147
147:       def top_left
148:         [left, top]
149:       end
top_right() click to toggle source

x,y coordinates of top right corner

     # File lib/prawn/layout/grid.rb, line 152
152:       def top_right
153:         [right, top]
154:       end
total_height() click to toggle source

:nodoc

     # File lib/prawn/layout/grid.rb, line 107
107:       def total_height
108:         pdf.bounds.height.to_f
109:       end
width() click to toggle source

Width of a box

     # File lib/prawn/layout/grid.rb, line 112
112:       def width
113:         grid.column_width.to_f
114:       end

Private Instance Methods

grid() click to toggle source
     # File lib/prawn/layout/grid.rb, line 185
185:       def grid
186:         pdf.grid
187:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.