class Prawn::Document::MultiBox
A MultiBox is specified by 2 Boxes and spans the areas between.
@group Experimental API
Attributes
pdf[R]
Public Class Methods
new(pdf, box1, box2)
click to toggle source
# File lib/prawn/grid.rb, line 217 def initialize(pdf, box1, box2) @pdf = pdf @boxes = [box1, box2] end
Public Instance Methods
bottom()
click to toggle source
# File lib/prawn/grid.rb, line 256 def bottom bottom_box.bottom end
bottom_left()
click to toggle source
# File lib/prawn/grid.rb, line 268 def bottom_left [left, bottom] end
bottom_right()
click to toggle source
# File lib/prawn/grid.rb, line 272 def bottom_right [right, bottom] end
bounding_box(&blk)
click to toggle source
# File lib/prawn/grid.rb, line 276 def bounding_box(&blk) pdf.bounding_box(top_left, width: width, height: height, &blk) end
gutter()
click to toggle source
# File lib/prawn/grid.rb, line 240 def gutter @boxes[0].gutter end
height()
click to toggle source
# File lib/prawn/grid.rb, line 236 def height top_box.top - bottom_box.bottom end
left()
click to toggle source
# File lib/prawn/grid.rb, line 244 def left left_box.left end
name()
click to toggle source
# File lib/prawn/grid.rb, line 224 def name @boxes.map(&:name).join(':') end
right()
click to toggle source
# File lib/prawn/grid.rb, line 248 def right right_box.right end
show(grid_color = 'CCCCCC')
click to toggle source
# File lib/prawn/grid.rb, line 280 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()
click to toggle source
# File lib/prawn/grid.rb, line 252 def top top_box.top end
top_left()
click to toggle source
# File lib/prawn/grid.rb, line 260 def top_left [left, top] end
top_right()
click to toggle source
# File lib/prawn/grid.rb, line 264 def top_right [right, top] end
total_height()
click to toggle source
# File lib/prawn/grid.rb, line 228 def total_height @boxes[0].total_height end
width()
click to toggle source
# File lib/prawn/grid.rb, line 232 def width right_box.right - left_box.left end
Private Instance Methods
bottom_box()
click to toggle source
# File lib/prawn/grid.rb, line 306 def bottom_box @bottom_box ||= @boxes.min_by(&:bottom) end
left_box()
click to toggle source
# File lib/prawn/grid.rb, line 294 def left_box @left_box ||= @boxes.min_by(&:left) end
right_box()
click to toggle source
# File lib/prawn/grid.rb, line 298 def right_box @right_box ||= @boxes.max_by(&:right) end
top_box()
click to toggle source
# File lib/prawn/grid.rb, line 302 def top_box @top_box ||= @boxes.max_by(&:top) end