This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
Delegate #readbyte on the abstract IO adapter, and improve documentation around custom processors #2034
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.
I recently implemented a custom processor that used the Exifr gem to extract EXIF information from images uploaded to a Paperclip attachment. Exifr's processor uses
readbyte
to parse the EXIF header, so it hit errors when Paperclip'sFile
-like object didn't have one. There's also a test for this delegation.I've also tidied up the README documentation for custom processors, hopefully to be more clear than before. There was some duplicated content between the "Post Processing" section and the "Custom Attachment Processing" section, and those sections were separated in the file. I've dedicated the "Post Processing" section to Paperclip's built in thumbnailing processors, and made "Custom Attachment Processing" section solely about writing & using your own custom processors. This should be a more understandable progression, as built-in functionality is discussed first & separately from extending Paperclip.
I've also tidied up a couple of inaccuracies in the
Paperclip::Processor
documentation, and generally applied Strunk & White's "Omit needless words" principle in the areas I've touched.