Class: Prawn::Document::LazyBoundingBox
- Inherits:
-
BoundingBox
- Object
- BoundingBox
- Prawn::Document::LazyBoundingBox
- Defined in:
- lib/prawn/layout/page.rb
Instance Method Summary collapse
-
#action(&block) ⇒ Object
Defines the block to be executed by LazyBoundingBox#draw.
-
#draw ⇒ Object
Sets Document#bounds to use the LazyBoundingBox for its bounds, runs the block specified by LazyBoundingBox#action, and then restores the original bounds of the document.
Instance Method Details
#action(&block) ⇒ Object
Defines the block to be executed by LazyBoundingBox#draw. Usually, this will be used via a higher level interface.
See the documentation for Document#lazy_bounding_box, Document#header, and Document#footer
57 58 59 |
# File 'lib/prawn/layout/page.rb', line 57 def action(&block) @action = block end |
#draw ⇒ Object
Sets Document#bounds to use the LazyBoundingBox for its bounds, runs the block specified by LazyBoundingBox#action, and then restores the original bounds of the document.
65 66 67 68 69 70 71 72 73 |
# File 'lib/prawn/layout/page.rb', line 65 def draw @parent.mask(:y) do parent_box = @parent.bounds @parent.bounds = self @parent.y = absolute_top @action.call @parent.bounds = parent_box end end |