Class: Prawn::Document::MultiBox
- Inherits:
-
Object
- Object
- Prawn::Document::MultiBox
- Defined in:
- lib/prawn/grid.rb
Overview
A MultiBox is specified by 2 Boxes and spans the areas between.
Experimental API collapse
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
Experimental API collapse
- #bottom ⇒ Object
- #bottom_left ⇒ Object
- #bottom_right ⇒ Object
- #bounding_box(&blk) ⇒ Object
- #gutter ⇒ Object
- #height ⇒ Object
-
#initialize(pdf, box1, box2) ⇒ MultiBox
constructor
A new instance of MultiBox.
- #left ⇒ Object
- #name ⇒ Object
- #right ⇒ Object
- #show(grid_color = 'CCCCCC') ⇒ Object
- #top ⇒ Object
- #top_left ⇒ Object
- #top_right ⇒ Object
- #total_height ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(pdf, box1, box2) ⇒ MultiBox
Returns a new instance of MultiBox.
216 217 218 219 |
# File 'lib/prawn/grid.rb', line 216 def initialize(pdf, box1, box2) @pdf = pdf @boxes = [box1, box2] end |
Instance Attribute Details
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
221 222 223 |
# File 'lib/prawn/grid.rb', line 221 def pdf @pdf end |
Instance Method Details
#bottom ⇒ Object
255 256 257 |
# File 'lib/prawn/grid.rb', line 255 def bottom bottom_box.bottom end |
#bottom_left ⇒ Object
267 268 269 |
# File 'lib/prawn/grid.rb', line 267 def bottom_left [left, bottom] end |
#bottom_right ⇒ Object
271 272 273 |
# File 'lib/prawn/grid.rb', line 271 def bottom_right [right, bottom] end |
#bounding_box(&blk) ⇒ Object
275 276 277 |
# File 'lib/prawn/grid.rb', line 275 def bounding_box(&blk) pdf.bounding_box(top_left, width: width, height: height, &blk) end |
#gutter ⇒ Object
239 240 241 |
# File 'lib/prawn/grid.rb', line 239 def gutter @boxes[0].gutter end |
#height ⇒ Object
235 236 237 |
# File 'lib/prawn/grid.rb', line 235 def height top_box.top - bottom_box.bottom end |
#left ⇒ Object
243 244 245 |
# File 'lib/prawn/grid.rb', line 243 def left left_box.left end |
#name ⇒ Object
223 224 225 |
# File 'lib/prawn/grid.rb', line 223 def name @boxes.map(&:name).join(':') end |
#right ⇒ Object
247 248 249 |
# File 'lib/prawn/grid.rb', line 247 def right right_box.right end |
#show(grid_color = 'CCCCCC') ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/prawn/grid.rb', line 279 def show(grid_color = 'CCCCCC') bounding_box do original_stroke_color = pdf.stroke_color pdf.stroke_color = grid_color pdf.text name pdf.stroke_bounds pdf.stroke_color = original_stroke_color end end |
#top ⇒ Object
251 252 253 |
# File 'lib/prawn/grid.rb', line 251 def top top_box.top end |
#top_left ⇒ Object
259 260 261 |
# File 'lib/prawn/grid.rb', line 259 def top_left [left, top] end |
#top_right ⇒ Object
263 264 265 |
# File 'lib/prawn/grid.rb', line 263 def top_right [right, top] end |
#total_height ⇒ Object
227 228 229 |
# File 'lib/prawn/grid.rb', line 227 def total_height @boxes[0].total_height end |
#width ⇒ Object
231 232 233 |
# File 'lib/prawn/grid.rb', line 231 def width right_box.right - left_box.left end |