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
-
#bottom ⇒ Float
y-coordinate of the bottom.
-
#bottom_left ⇒ Array(Float, Float)
x,y coordinates of bottom left corner.
-
#bottom_right ⇒ Array(Float, Float)
x,y coordinates of bottom right corner.
-
#bounding_box { ... } ⇒ void
Creates a standard bounding box based on the grid box.
-
#gutter ⇒ Float
Width of the gutter.
-
#height ⇒ Float
Height of a box.
-
#initialize(pdf, box1, box2) ⇒ MultiBox
constructor
A new instance of MultiBox.
-
#left ⇒ Float
x-coordinate of left side.
-
#name ⇒ String
Mostly diagnostic method that outputs the name of a box.
-
#right ⇒ Float
x-coordinate of right side.
-
#show(grid_color = 'CCCCCC') ⇒ void
Drawn the box.
-
#top ⇒ Float
y-coordinate of the top.
-
#top_left ⇒ Array(Float, Float)
x,y coordinates of top left corner.
-
#top_right ⇒ Array(Float, Float)
x,y coordinates of top right corner.
-
#width ⇒ Float
Width of a box.
Constructor Details
#initialize(pdf, box1, box2) ⇒ MultiBox
Returns a new instance of MultiBox.
Source Code
299 | def initialize(pdf, box1, box2) |
300 | @pdf = pdf |
301 | @boxes = [box1, box2] |
302 | end
|
Instance Method Details
#bottom ⇒ Float
y-coordinate of the bottom.
Source Code
364 | def bottom |
365 | bottom_box.bottom |
366 | end
|
#bottom_left ⇒ Array(Float, Float)
x,y coordinates of bottom left corner.
Source Code
385 | def bottom_left |
386 | [left, bottom] |
387 | end
|
#bottom_right ⇒ Array(Float, Float)
x,y coordinates of bottom right corner.
Source Code
392 | def bottom_right |
393 | [right, bottom] |
394 | end
|
#bounding_box { ... } ⇒ void
This method returns an undefined value.
Creates a standard bounding box based on the grid box.
Source Code
400 | def bounding_box(&blk) |
401 | pdf.bounding_box(top_left, width: width, height: height, &blk) |
402 | end
|
#gutter ⇒ Float
Width of the gutter.
Source Code
336 | def gutter |
337 | @boxes[0].gutter |
338 | end
|
#height ⇒ Float
Height of a box.
Source Code
329 | def height |
330 | top_box.top - bottom_box.bottom |
331 | end
|
#left ⇒ Float
x-coordinate of left side.
Source Code
343 | def left |
344 | left_box.left |
345 | end
|
#name ⇒ String
Mostly diagnostic method that outputs the name of a box.
Source Code
310 | def name |
311 | @boxes.map(&:name).join(':') |
312 | end
|
#right ⇒ Float
x-coordinate of right side.
Source Code
350 | def right |
351 | right_box.right |
352 | end
|
#show(grid_color = 'CCCCCC') ⇒ void
This method returns an undefined value.
Drawn the box. Diagnostic method.
Source Code
408 | def show(grid_color = 'CCCCCC') |
409 | bounding_box do |
410 | original_stroke_color = pdf.stroke_color |
411 | |
412 | pdf.stroke_color = grid_color |
413 | pdf.text(name) |
414 | pdf.stroke_bounds |
415 | |
416 | pdf.stroke_color = original_stroke_color |
417 | end
|
418 | end
|
#top ⇒ Float
y-coordinate of the top.
Source Code
357 | def top |
358 | top_box.top |
359 | end
|
#top_left ⇒ Array(Float, Float)
x,y coordinates of top left corner.
Source Code
371 | def top_left |
372 | [left, top] |
373 | end
|
#top_right ⇒ Array(Float, Float)
x,y coordinates of top right corner.
Source Code
378 | def top_right |
379 | [right, top] |
380 | end
|
#width ⇒ Float
Width of a box.
Source Code
322 | def width |
323 | right_box.right - left_box.left |
324 | end
|