Method: Prawn::Document#padded
- Defined in:
- lib/barkest_core/extensions/prawn_document_extensions.rb
#padded(padding = 2, &block) ⇒ Object
Creates a bounded box inside of the current bounds with side and top padding, then it executes the provided code block.
This can be useful to provide padding to the left and above text inside of a layout box.
186 187 188 189 190 |
# File 'lib/barkest_core/extensions/prawn_document_extensions.rb', line 186 def padded(padding = 2, &block) r = bounds padding ||= 2 bounding_box([padding, r.top - padding], width: r.width - (2 * padding), &block) end |