From b2a033e92b75b8c98b3ef91c5ae5aa063762ff13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 27 Jun 2019 01:54:40 +0200 Subject: [PATCH] REFACTOR: use Ruby's sum --- lib/post_revisor.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/post_revisor.rb b/lib/post_revisor.rb index 527440f76f0..4b167976264 100644 --- a/lib/post_revisor.rb +++ b/lib/post_revisor.rb @@ -280,12 +280,9 @@ class PostRevisor end def diff_size(before, after) - changes = 0 - ONPDiff.new(before, after).short_diff.each do |str, type| - next if type == :common - changes += str.length + ONPDiff.new(before, after).short_diff.sum do |str, type| + type == :common ? 0 : str.size end - changes end def ninja_edit?