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.
218 219 220 221 |
# File 'lib/prawn/grid.rb', line 218 def initialize(pdf, box1, box2) @pdf = pdf @boxes = [box1, box2] end |
Instance Attribute Details
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
223 224 225 |
# File 'lib/prawn/grid.rb', line 223 def pdf @pdf end |
Instance Method Details
#bottom ⇒ Object
257 258 259 |
# File 'lib/prawn/grid.rb', line 257 def bottom bottom_box.bottom end |
#bottom_left ⇒ Object
269 270 271 |
# File 'lib/prawn/grid.rb', line 269 def bottom_left [left, bottom] end |
#bottom_right ⇒ Object
273 274 275 |
# File 'lib/prawn/grid.rb', line 273 def bottom_right [right, bottom] end |
#bounding_box(&blk) ⇒ Object
277 278 279 |
# File 'lib/prawn/grid.rb', line 277 def bounding_box(&blk) pdf.bounding_box(top_left, width: width, height: height, &blk) end |
#gutter ⇒ Object
241 242 243 |
# File 'lib/prawn/grid.rb', line 241 def gutter @boxes[0].gutter end |
#height ⇒ Object
237 238 239 |
# File 'lib/prawn/grid.rb', line 237 def height top_box.top - bottom_box.bottom end |
#left ⇒ Object
245 246 247 |
# File 'lib/prawn/grid.rb', line 245 def left left_box.left end |
#name ⇒ Object
225 226 227 |
# File 'lib/prawn/grid.rb', line 225 def name @boxes.map(&:name).join(':') end |
#right ⇒ Object
249 250 251 |
# File 'lib/prawn/grid.rb', line 249 def right right_box.right end |
#show(grid_color = 'CCCCCC') ⇒ Object
281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/prawn/grid.rb', line 281 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
253 254 255 |
# File 'lib/prawn/grid.rb', line 253 def top top_box.top end |
#top_left ⇒ Object
261 262 263 |
# File 'lib/prawn/grid.rb', line 261 def top_left [left, top] end |
#top_right ⇒ Object
265 266 267 |
# File 'lib/prawn/grid.rb', line 265 def top_right [right, top] end |
#total_height ⇒ Object
229 230 231 |
# File 'lib/prawn/grid.rb', line 229 def total_height @boxes[0].total_height end |
#width ⇒ Object
233 234 235 |
# File 'lib/prawn/grid.rb', line 233 def width right_box.right - left_box.left end |