Class: Prawn::DocumentBuilder::Layout

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/document_builder/layout.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder, document) ⇒ Layout

Returns a new instance of Layout.



4
5
6
7
# File 'lib/prawn/document_builder/layout.rb', line 4

def initialize(builder, document)
  @builder  = builder
  @document = document
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



9
10
11
# File 'lib/prawn/document_builder/layout.rb', line 9

def builder
  @builder
end

#documentObject (readonly)

Returns the value of attribute document.



9
10
11
# File 'lib/prawn/document_builder/layout.rb', line 9

def document
  @document
end

Instance Method Details

#overflow(command) ⇒ Object



19
20
21
22
# File 'lib/prawn/document_builder/layout.rb', line 19

def overflow(command)
  document.start_new_page
  builder.commands.unshift(command)
end

#remaining_spaceObject



11
12
13
14
15
16
17
# File 'lib/prawn/document_builder/layout.rb', line 11

def remaining_space
  Prawn::Document::BoundingBox.new(
    document.bounds, [0,document.cursor], 
    :width  => document.bounds.width, 
    :height => document.cursor
  )
end