方法
實例公開方法
require_dependency(檔案名稱) 連結
警告:此方法已過時。自動載入器語意與 Ruby 相符,且您不再需要防衛性的載入順序。請正常參照類別和模組。
如果執行時間模式為 :classic
,則不控制其父應用程式執行模式的 Engine 應在需要的地方呼叫 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