Caching tabs in Haml::Buffer is good.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@508 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-05-08 07:44:22 +00:00
parent 5a5caf6ed3
commit 8509286ad2
1 changed files with 4 additions and 1 deletions

View File

@ -165,10 +165,13 @@ module Haml
private private
@@tab_cache = {}
# Gets <tt>count</tt> tabs. Mostly for internal use. # Gets <tt>count</tt> tabs. Mostly for internal use.
def tabs(count) def tabs(count)
@real_tabs = count @real_tabs = count
' ' * (count + @tabulation) tabs = count + @tabulation
' ' * tabs
@@tab_cache[tabs] ||= ' ' * tabs
end end
# Iterates through the classes and ids supplied through <tt>.</tt> # Iterates through the classes and ids supplied through <tt>.</tt>