diff --git a/lib/jekyll/liquid_renderer.rb b/lib/jekyll/liquid_renderer.rb index a79f06bd..547fa4c7 100644 --- a/lib/jekyll/liquid_renderer.rb +++ b/lib/jekyll/liquid_renderer.rb @@ -22,19 +22,16 @@ module Jekyll ) LiquidRenderer::File.new(self, filename).tap do - @stats[filename] ||= {} - @stats[filename][:count] ||= 0 + @stats[filename] ||= new_profile_hash @stats[filename][:count] += 1 end end def increment_bytes(filename, bytes) - @stats[filename][:bytes] ||= 0 @stats[filename][:bytes] += bytes end def increment_time(filename, time) - @stats[filename][:time] ||= 0.0 @stats[filename][:time] += time end @@ -45,5 +42,10 @@ module Jekyll def self.format_error(e, path) "#{e.message} in #{path}" end + + private + def new_profile_hash + Hash.new { |hash, key| hash[key] = 0 } + end end end