DEV: Apply syntax_tree formatting to lib/*

This commit is contained in:
David Taylor
2023-01-09 12:10:19 +00:00
parent b0fda61a8e
commit 6417173082
507 changed files with 16550 additions and 12627 deletions

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true
module ImageSizer
# Resize an image to the aspect ratio we want
def self.resize(width, height, opts = {})
return if width.blank? || height.blank?
@ -12,7 +11,7 @@ module ImageSizer
w = width.to_f
h = height.to_f
return [w.floor, h.floor] if w <= max_width && h <= max_height
return w.floor, h.floor if w <= max_width && h <= max_height
ratio = [max_width / w, max_height / h].min
[(w * ratio).floor, (h * ratio).floor]
@ -27,11 +26,10 @@ module ImageSizer
w = width.to_f
h = height.to_f
return [w.floor, h.floor] if w <= max_width && h <= max_height
return w.floor, h.floor if w <= max_width && h <= max_height
ratio = max_width / w
[[max_width, w].min.floor, [max_height, (h * ratio)].min.floor]
end
end