From 4fa7fdd14bda2b8bcb3f551fc7c678e93fe26c0e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 30 Jan 2010 15:50:25 -0800 Subject: [PATCH] Speed up compilation a bit. --- doc-src/lib/stylesheets.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index 5f7114de..723bed3b 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -128,11 +128,20 @@ def mixin_signature(mixin) mixin.sass_signature(:include) end -def mixin_examples(item, mixin) - @items.select do |i| - i[:example] && +def example_items + @example_items ||= @items.select{|i| i[:example]} +end + +def examples_for_item(item) + @examples ||= {} + @examples[item] ||= example_items.select do |i| i[:framework] == item[:framework] && - i[:stylesheet] == item[:stylesheet] && + i[:stylesheet] == item[:stylesheet] + end +end + +def mixin_examples(item, mixin) + examples_for_item(item).select do |i| i[:mixin] == mixin.name end.map{|i| i.reps.find{|r| r.name == :default}} end