From 26675216adbef8d52064535697c52184d0ea37df Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 10 Jun 2011 11:35:54 -0400 Subject: [PATCH] don't do things twice, it wastes time --- lib/jasmine/files_list.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jasmine/files_list.rb b/lib/jasmine/files_list.rb index 9ee7891..3b4de7d 100644 --- a/lib/jasmine/files_list.rb +++ b/lib/jasmine/files_list.rb @@ -15,6 +15,8 @@ module Jasmine @files = DEFAULT_FILES.dup @filtered_files = @files.dup use_config! if config? + + @code_for_file = {} end def use_spec?(file) @@ -36,7 +38,9 @@ module Jasmine private def to_html(files) files.collect { |file| - case File.extname(file) + next @code_for_file[file] if @code_for_file[file] + + @code_for_file[file] = (case File.extname(file) when '.js' %{} when '.coffee' @@ -50,7 +54,7 @@ module Jasmine end when '.css' %{} - end + end) } end