From a0459ebd33e7aabc16fe5d2a62780078adce2e50 Mon Sep 17 00:00:00 2001 From: Geoff Youngs Date: Sun, 22 Oct 2023 15:19:03 +0100 Subject: [PATCH] fix(bug): not_equal_to_one() returned invalid results for float < 1 --- lib/morandi/image_processor.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/morandi/image_processor.rb b/lib/morandi/image_processor.rb index 8e79b02..9c99179 100644 --- a/lib/morandi/image_processor.rb +++ b/lib/morandi/image_processor.rb @@ -182,7 +182,7 @@ def apply_crop! return if crop.nil? && config_for('image.auto-crop').eql?(false) - crop = crop.split(/,/).map(&:to_i) if crop.is_a?(String) && crop =~ /^\d+,\d+,\d+,\d+/ + crop = crop.split(',').map(&:to_i) if crop.is_a?(String) && crop =~ /^\d+,\d+,\d+,\d+/ crop = nil unless crop.is_a?(Array) && crop.size.eql?(4) && crop.all? do |i| i.is_a?(Numeric) @@ -238,7 +238,7 @@ def apply_decorations! private def not_equal_to_one(float) - (float - 1.0) >= Float::EPSILON + (float - 1.0).abs >= Float::EPSILON end end # rubocop:enable Metrics/ClassLength