Remove superfluous pdf-core requires - #1032
Merged
Merged
Conversation
pointlessone
approved these changes
Jul 5, 2017
Member
|
Thank you for your contribution! |
Member
|
Please rebase his branch and let it go through CI. |
We require `pdf/core` in `lib/prawn.rb`, and were requiring `pdf/core/text` and `pdf/core/byte_string` in `lib/prawn/text.rb` and `lib/prawn/security.rb` respectively. Those second requires were causing double-loads and warnings under certain circumstances because of a bug in Ruby (https://bugs.ruby-lang.org/issues/10222). We use objects under the `PDF::Core` namespace freely throught Prawn and those two requires seem to be both out of character (in the rest of the codebase it's assumed that `PDF::Core` has already been required), and overkill (`pdf-core`'s codebase itself generally assumes that all the objects under its namespace are already required). I think it's safe to just remove these requires deeper into `pdf-core` - it makes these double-load problems go away and is more in keeping with the way the code is structured. There is the larger question of the architecture of `pdf-core` – whether it's a grab-bag of objects and modules to be picked-and-chosen from, or a single entity that should be used complete. I don't think there's a significant impact to that process from this approach to removing the warnings.
fidothe
force-pushed
the
sidestep-double-load-ruby-bug
branch
from
July 5, 2017 12:45
c31c2c4 to
8e753d6
Compare
pointlessone
approved these changes
Jul 5, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We require
pdf/coreinlib/prawn.rb, and were requiringpdf/core/textandpdf/core/byte_stringinlib/prawn/text.rbandlib/prawn/security.rbrespectively.Those second requires were causing double-loads and warnings under
certain circumstances because of a bug in Ruby
(https://bugs.ruby-lang.org/issues/10222).
We use objects under the
PDF::Corenamespace freely throught Prawn andthose two requires seem to be both out of character (in the rest of the
codebase it's assumed that
PDF::Corehas already been required), andoverkill (
pdf-core's codebase itself generally assumes that all theobjects under its namespace are already required).
I think it's safe to just remove these requires deeper into
pdf-core-it makes these double-load problems go away and is more in keeping with
the way the code is structured.
There is the larger question of the architecture of
pdf-core– whetherit's a grab-bag of objects and modules to be picked-and-chosen from, or
a single entity that should be used complete. I don't think there's a
significant impact to that process from this approach to removing the
warnings.
Fixes #1024
Obsoletes #1026