方法
实例公共方法
require_dependency(filename) 链接
警告: 此方法已废弃。自动加载程序的语义与 Ruby 的相同,您不再需要担心加载顺序。只需正常引用类和模块即可。
不控制其父应用程序运行模式的引擎,应在需要时调用 require_dependency,以防运行时模式为 :classic。
来源: 显示 | 在 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