class Prawn::Text::Box

Generally, one would use the Prawn::Text#text_box convenience method. However, using Text::Box.new in conjunction with render(:dry_run=> true) enables one to do look-ahead calculations prior to placing text on the page, or to determine how much vertical space was consumed by the printed text

Public Class Methods

new(string, options = {}) click to toggle source
Calls superclass method Prawn::Text::Formatted::Box::new
# File lib/prawn/text/box.rb, line 132
def initialize(string, options = {})
  super([{ text: string }], options)
end

Public Instance Methods

render(flags = {}) click to toggle source
Calls superclass method Prawn::Text::Formatted::Box#render
# File lib/prawn/text/box.rb, line 136
def render(flags = {})
  leftover = super(flags)
  leftover.map { |hash| hash[:text] }.join
end