Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate on_page_create method to renderer. #797 #825

Merged
merged 2 commits into from
Feb 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ should benefit greatly from these changes.

(Gregory Brown, [#793](https://github.com/prawnpdf/prawn/pull/793))

### Temporarily restored the Document#on_page_create method

This method was moved into PDF::Core in the Prawn 1.3.0 release, removing
it from the `Prawn::Document` API. Although it is a low-level method not
meant for general use, it is necessary for certain tasks that we do not
have proper support for elsewhere.

This method should still be considered part of Prawn's internals and is subject
to change at any time, but we have restored it temporarily until we have
a suitable replacement for it. See the discussion on [#797](https://github.com/prawnpdf/prawn/issues/797)
for more details.

(Jesse Doyle, [#797](https://github.com/prawnpdf/prawn/issues/797), [#825](https://github.com/prawnpdf/prawn/pull/825))

## PrawnPDF 1.3.0 -- September 28, 2014

### Added the Prawn::View mixin for using Prawn's DSL in your own classes.
Expand Down
3 changes: 2 additions & 1 deletion lib/prawn/document/internals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ module Internals
# Anyway, for now it's not clear what we should do w. them.
delegate [ :graphic_state,
:save_graphics_state,
:restore_graphics_state ] => :renderer
:restore_graphics_state,
:on_page_create ] => :renderer

# FIXME: This is a circular reference, because in theory Prawn should
# be passing instances of renderer to PDF::Core::Page, but it's
Expand Down
4 changes: 4 additions & 0 deletions spec/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ def self.format(string)
create_pdf
end

it "should be delegated from Document to renderer" do
expect(@pdf.respond_to?(:on_page_create)).to be_true
end

it "should be invoked with document" do
called_with = nil

Expand Down