From 8509286ad2bccf27eb01f873b5fe7ec296e44cda Mon Sep 17 00:00:00 2001 From: nex3 Date: Tue, 8 May 2007 07:44:22 +0000 Subject: [PATCH] Caching tabs in Haml::Buffer is good. git-svn-id: svn://hamptoncatlin.com/haml/trunk@508 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/haml/buffer.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/haml/buffer.rb b/lib/haml/buffer.rb index 2ba5cf61..acbd0628 100644 --- a/lib/haml/buffer.rb +++ b/lib/haml/buffer.rb @@ -165,10 +165,13 @@ module Haml private + @@tab_cache = {} # Gets count tabs. Mostly for internal use. def tabs(count) @real_tabs = count - ' ' * (count + @tabulation) + tabs = count + @tabulation + ' ' * tabs + @@tab_cache[tabs] ||= ' ' * tabs end # Iterates through the classes and ids supplied through .