ddengler / prawn-grouping

A gem to add a more flexible grouping option to the prawn gem
https://github.com/ddengler/prawn-grouping
MIT License
14 stars 21 forks source link

Potential for Infinite Recursion #6

Closed jeffreylammers closed 10 years ago

jeffreylammers commented 10 years ago

I did not test this explicitly, but after understanding how this grouping works and looking at the source, it seems that if the content that is grouped is larger than a single page, then the group function would endlessly call itself. I can test this, but just wanted to share the observation.

ddengler commented 10 years ago

It does not and there should already be a test for this, but I will review it again, when looking into another issue. Just to be sure.

ddengler commented 10 years ago

There is a test for this and the too_tall callback is called in this case. I am closing this. Feel free to reopen with a test case, if you run into any issues with this.

jeffreylammers commented 10 years ago

Sorry - you are of course right. Maxes out at 3 iterations. I see it now. This was my test:

Prawn::Document.generate("recursion.pdf") do
  text "before block that is bigger than a page"
  group_iter = 0
  group do
    puts "group_iter: #{group_iter}"
    text "blah " * 1200
    group_iter += 1
  end
  text "after block that is bigger than a page"
end