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
Modularize SanitizedFile#copy_to and SanitizedFile#move_to #1850
Conversation
reference_scale = scale_x >= scale_y ? scale_x : scale_y | ||
cols = (reference_scale * (cols + 0.5)).round | ||
rows = (reference_scale * (rows + 0.5)).round | ||
reference_scale == scale_x ? cmd.resize("#{cols}") : cmd.resize("x#{rows}") |
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.
Is this assignment required?
I like the changes to |
As for the As for |
Perhaps something more like this: scale_x, scale_y = width / cols.to_f, height / rows.to_f
scale = [scale_x, scale_y].max
cols, rows = [cols, rows].map {|dim| dim * scale } |
I thought about this, but then you will have to deal with this Anyways I updated it. |
@oss92 Would you be able to split out the changes to |
Done. Updated this pull request and will create another for the other changes if you'd like. |
Refactor file manipulation methods in SanitizedFile
I have edited some parts to decrease complexity and code duplication.