Hiroyuki Komatsu
komat****@users*****
2005年 2月 24日 (木) 14:27:53 JST
Index: prime/lib/session.rb diff -u prime/lib/session.rb:1.4.4.23 prime/lib/session.rb:1.4.4.24 --- prime/lib/session.rb:1.4.4.23 Tue Feb 1 08:37:44 2005 +++ prime/lib/session.rb Thu Feb 24 14:27:53 2005 @@ -1,5 +1,5 @@ # session.rb: -# $Id: session.rb,v 1.4.4.23 2005/01/31 23:37:44 komatsu Exp $ +# $Id: session.rb,v 1.4.4.24 2005/02/24 05:27:53 komatsu Exp $ # # Copyright (C) 2005 Hiroyuki Komatsu <komat****@taiya*****> # All rights reserved. @@ -9,6 +9,8 @@ # the GNU General Public License version 2. class PrimeSession + @@engine_cache = {} + def initialize (name, engine_classes) @name = name @language = "" @@ -21,7 +23,11 @@ def initialize_engines (engine_classes) engines = engine_classes.map { | engine_class | - eval( engine_class.to_s ).new() + if @@engine_cache.has_key?( engine_class ) then + @@engine_cache[ engine_class ] + else + @@engine_cache[ engine_class ] = eval( engine_class.to_s ).new() + end } def engines.command (method, *args)