Skip to content

Commit

Permalink
Remove deprecated support for non-string template code in PrawnTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Jun 5, 2023
1 parent 6dbfd43 commit 6927599
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master

* Remove deprecated support for non-string template code in PrawnTemplate (jeremyevans)
* Remove deprecated support for {ERB,Erubis}Template#default_output_variable{,=} (jeremyevans)
* Remove deprecated support for CoffeeScriptTemplate.default_no_wrap{,=} (jeremyevans)
* Remove deprecated support for RedCarpet 1.x (jeremyevans)
Expand Down
13 changes: 3 additions & 10 deletions lib/tilt/prawn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ def prepare

def evaluate(scope, locals, &block)
pdf = @engine
if @data.respond_to?(:to_str)
locals = locals.dup
locals[:pdf] = pdf
super
else
warn "Non-string provided as prawn template data. This is no longer supported and support for it will be removed in Tilt 2.3", :uplevel=>2
# :nocov:
@data.call(pdf) if @data.kind_of?(Proc)
# :nocov:
end
locals = locals.dup
locals[:pdf] = pdf
super
pdf.render
end

Expand Down
5 changes: 0 additions & 5 deletions test/tilt_prawntemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ def page_attributes(page_num=1)
assert_equal Tilt::PrawnTemplate, Tilt['test.prawn']
end

deprecated "can be initialized without a string" do
template = Tilt::PrawnTemplate.new{}
assert_equal true, template.render.start_with?('%PDF')
end

it "renders inline prawn templates" do
template = Tilt::PrawnTemplate.new { |t| "pdf.text \"Hello PDF!\"" }
3.times do
Expand Down

0 comments on commit 6927599

Please sign in to comment.