方法
实例公共方法
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