Use require_relative to prevent encoding.rb from being loaded twice #618
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.
Ever since 2c321b2, I get this warning when loading up a console session:
From what I can tell, this happens because prawn.rb now uses
require_relative
to load in the rest of the library. When it loadsprawn/font
,prawn/font/afm
gets required, which in turn requiresprawn/encoding
. Next, prawn.rb loadsprawn/encoding
, which should be ignored, because it's already loaded, but what I find is that, for me, locally,require
loads encoding.rb from/usr/local/opt/rbenv/{etc}
, whilerequire_relative
loads it from/usr/local/Cellar/rbenv/{etc}
.These are the same files (I'm using rbenv and homebrew), but it seems like ruby doesn't realize that and tries to load both. This commit switches the
require
in afm.rb to userequire_relative
, which resolves the issue for me.If there is an alternate way to resolve this, perhaps at a config level on just my system, I am all ears!