Hi Marcus,
This is not strictly Prawn question but OK.
You can try this trick. Let's say you have two classes that represent documents (not Prawn::Document). You can arrange them like this:
class Doc1
def initialize(prawn_doc = nil)
@prawn_doc = prawn_doc || Prawn::Document.new
end
end
Then, whenever you want to include another document into the current document you pass its constructor Prawn document you already have.
class Doc1
def render
# Do what this doc need to do to render a beautiful document
AnotherDoc.new(@prawn_doc).render
# Do more awesome drawing
end
end
And when you don't include that another document you just skip the constructor argument and let it create its own prawn document.
AnotherDoc.new.render
Hope this helps.
--
Regards,
Alex