-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Analyzer] Refacto our image analyzers to further expand the gem (#254) #299
[Analyzer] Refacto our image analyzers to further expand the gem (#254) #299
Conversation
521f837
to
0362bc0
Compare
0362bc0
to
274bcad
Compare
fe7e3d0
to
0ef64e4
Compare
fa48e7e
to
77491c6
Compare
7b06bb0
to
cb2d918
Compare
cb2d918
to
96033ed
Compare
Self note: ensure #242 is handled with this? |
|
||
def read_image | ||
begin | ||
require "mini_magick" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question if we need to require it always here
can we just check if defined?(MiniMagick)?
and maybe raise the error even sooner, in the initializer (check when the app boots if possible)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you, I think we do not need to require it every time. That's, indeed, not necessary, plus not doing it has performance benefits.
I am updating the code with a unless defined?(MiniMagick)
(same for Vips), as it was done previouslu by the metadata.rb
file (I should have ketp it).
For the second part, we could raise the error at the app boot, but I think this will enforce the user to have both imagemagick
and ruby-vips
gem in their Gemfile
(which we do not want). Plus, if the user does not use validators based on the image analyzers, it's not necessary to have either imagemagick
or ruby-vips
gem. Therefore I think it's better to leave it this way? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Object.const_defined?(:Vips)
is better than unless defined?(Vips)
because we might not have loaded the lib yet, therefore it might not be defined yet. Whereas Object.const_defined?(:Vips)
is about presence in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with bject.const_defined?(:Vips)
I'm also fine if it just raises an exception and we will have something about it in the docs. Not the most user friendly but this should be expected. Bu this option is least preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igorkasyanchuk I finally opted for defined?(xxx)
. It is the best option you are right. Let me know if the PR is okay with you now :)
44a6c6f
to
96033ed
Compare
…rageanalyzerimageanalyzerimagemagickvipsnewblobmetadata
No description provided.