lib/hexapdf/layout/page_style.rb in hexapdf-0.32.2 vs lib/hexapdf/layout/page_style.rb in hexapdf-0.33.0
- old
+ new
@@ -93,25 +93,25 @@
# Defines the name of the page style that should be used for the next page.
#
# If this attribute is +nil+ (the default), it means that this style should be used again.
attr_accessor :next_style
- # Creates a new page style instance for the given page size and orientation. If a block is
- # given, it is used as template for defining the initial content.
+ # Creates a new page style instance for the given page size, orientation and next style
+ # values. If a block is given, it is used as template for defining the initial content.
#
# Example:
#
# PageStyle.new(page_size: :Letter) do |canvas, style|
# style.frame = style.create_frame(canvas.context, 72)
# style.next_style = :other
# canvas.fill_color("fd0") { canvas.circle(100, 100, 50).fill }
# end
- def initialize(page_size: :A4, orientation: :portrait, &block)
+ def initialize(page_size: :A4, orientation: :portrait, next_style: nil, &block)
@page_size = page_size
@orientation = orientation
@template = block
@frame = nil
- @next_style = nil
+ @next_style = next_style
end
# Creates a new page in the given document with this page style and returns it.
#
# If #frame has not been set beforehand or during execution of the #template, a default frame