Class: Prawn::DocumentBuilder::FlowingTextConstruct

Inherits:
Command
  • Object
show all
Defined in:
lib/prawn/document_builder/constructs/flowing_text_construct.rb

Instance Attribute Summary

Attributes inherited from Command

#box, #name, #params

Instance Method Summary collapse

Methods inherited from Command

#execute, #initialize, #restore_params, #save_params, #teardown

Constructor Details

This class inherits a constructor from Prawn::DocumentBuilder::Command

Instance Method Details

#setupObject



4
5
6
# File 'lib/prawn/document_builder/constructs/flowing_text_construct.rb', line 4

def setup
  @contents = params.delete(:contents) 
end

#text(document, layout) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/prawn/document_builder/constructs/flowing_text_construct.rb', line 8

def text(document, layout)
  box = layout.remaining_space
  excess = document.text_box(@contents, { :at => box.top_left, :width => box.width, :height => box.height }.merge(params))
  unless excess.empty?
    layout.overflow(FlowingTextConstruct.new(:text, params.merge(:contents => excess)))  
  end
end