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

Update prawn-grouping.gemspec #1

Closed serra-allgood closed 10 years ago

serra-allgood commented 10 years ago

Update prawn dependency to ~> 1.0.0 in order to play around with it

ddengler commented 10 years ago

@corwinkelly Thx. I will also run some more tests now that 1.0 is released and release a new version to rubygems. Please let me know if you have any issues.

serra-allgood commented 10 years ago

@ddengler No problem! I did notice an issue with the use case I'm working with. I have a model set up to inherit from Prawn, and calling one of the model's method inside a group block results in a NoMethodError. I was gonna take a look at fixing it at work tomorrow.

ddengler commented 10 years ago

@corwinkelly The issues ist probably that a new virtual document is created to do the simulation of the grouping process. This Document does not inherit from your subclass. One of the approaches in prawn was to create a deep copy of the existing document, but this resulted in a few issues, which is why I am not trying to create a deep copy anymore. You should be able to solve your problem by extending the Prawn Document via the extension API instead of subclassing it.

Prawn::Document.extensions << Your::Module
serra-allgood commented 10 years ago

@ddengler OK, I can dig it! I'll give it a shot and report back. If it works, mind if I open an issue about it so it can be instantly closed with the solution so it'll be easier for people to find in the future?

ddengler commented 10 years ago

@corwinkelly Great, thanks! Of course you can start an issue for this. I started the grouping addon in preparation for an upcoming project. If the approach turns out to solve the original grouping issues and not introduce a lot of new ones, we might be able to merge this back into prawn itself.