From a0da18e4f85c9b844bd29da5bfc7c1b24aedcdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 30 Nov 2014 14:30:22 +0100 Subject: [PATCH] Incorporate code review feedback --- lib/jekyll/commands/doctor.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index 5d3dfc61..8da68956 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -95,13 +95,10 @@ module Jekyll end def collect_urls_case_insensitive(urls, things, destination) - things.each do |thing| - dest = thing.destination(destination) - if urls[dest.downcase] - urls[dest.downcase] << dest - else - urls[dest.downcase] = [dest] - end + things.inject(urls) do |memo, thing| + dest = thing.destination(destination) + (memo[dest.downcase] ||= []) << dest + memo end urls end