Class: Prawn::Text::Box
- Inherits:
-
Formatted::Box
- Object
- Formatted::Box
- Prawn::Text::Box
- Defined in:
- lib/prawn/text/box.rb
Overview
Experimental API collapse
-
#initialize(string, options = {}) ⇒ Box
constructor
A new instance of Box.
-
#render(flags = {}) ⇒ String
Render text to the document based on the settings defined in constructor.
Constructor Details
#initialize(string, options = {}) ⇒ Box
Returns a new instance of Box.
Source Code
lib/prawn/text/box.rb, line 165
165 | def initialize(string, options = {}) |
166 | super([{ text: string }], options) |
167 | end
|
Instance Method Details
#render(flags = {}) ⇒ String
Render text to the document based on the settings defined in constructor.
In order to facilitate look-ahead calculations, this method accepts
a dry_run: true
option. If provided, then everything is executed as if
rendering, with the exception that nothing is drawn on the page. Useful
for look-ahead computations of height, unprinted text, etc.
Source Code
lib/prawn/text/box.rb, line 186
186 | def render(flags = {}) |
187 | leftover = super(flags) |
188 | leftover.map { |hash| hash[:text] }.join |
189 | end
|