2009年8月23日日曜日

[Rails][CodeReading] Rails::Initializer (9) preload_frameworks

Initializer.process で9番目に呼ばれる preload_frameworks メソッド。

# Preload all frameworks specified by the Configuration#frameworks.
# Used by Passenger to ensure everything's loaded before forking and
# to avoid autoload race conditions in JRuby.
def preload_frameworks
if configuration.preload_frameworks
configuration.frameworks.each do |framework|
# String#classify and #constantize aren't available yet.
toplevel = Object.const_get(framework.to_s.gsub(/(?:^|_)(.)/) { $1.upcase })
toplevel.load_all! if toplevel.respond_to?(:load_all!)
end
end
end

詳細不明・・・(ごめんなさい)。
Configuration.preload_frameworks は、デフォルトで false になっています。

def default_preload_frameworks
false
end


[Rails][CodeReading] Railsの初期化コードを読む (イントロ&目次)

0 件のコメント:

コメントを投稿