方法
執行個體公開方法
require_dependency(filename) 連結
警告:此方法已過時。自動載入程式的語意與 Ruby 相符,您不再需要對載入順序採取防禦措施。請直接參照類別和模組。
如果執行階段模式為 :classic
,則不控制其父應用程式執行模式的引擎應在需要時呼叫 require_dependency
。
來源: 顯示 | 在 GitHub 上
# File activesupport/lib/active_support/dependencies/require_dependency.rb, line 11 def require_dependency(filename) filename = filename.to_path if filename.respond_to?(:to_path) unless filename.is_a?(String) raise ArgumentError, "the file name must be either a String or implement #to_path -- you passed #{filename.inspect}" end if abspath = ActiveSupport::Dependencies.search_for_file(filename) require abspath else require filename end end