Skip to content

Commit

Permalink
Fix render forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgessler committed Feb 28, 2024
1 parent ee91e09 commit 60c2443
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/phlex/pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Error < StandardError; end

include Prawn::View

def call(document, &block)
def call(document = Prawn::Document.new, &block)
@document = document
around_template do
if block_given?
Expand Down Expand Up @@ -76,9 +76,10 @@ def render(renderable, &block)
end

class << self
def document(document = Prawn::Document.new)
new.call(document)
document
def document(...)
Prawn::Document.new.tap do |document|
new(...).call(document)
end
end

def render(...)
Expand Down

0 comments on commit 60c2443

Please sign in to comment.