Top Level Namespace
Defined Under Namespace
Modules: Coaster Classes: Array, Date, Month, Object, StandardError, String
Instance Method Summary collapse
Instance Method Details
#require_more ⇒ Object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/coaster/core_ext/require_more.rb', line 1 def require_more required_file_path = caller[0].split(':', 2).first load_name = nil load_path_index = $LOAD_PATH.each_with_index do |load_path, ix| scanned = required_file_path.scan(/(#{load_path})#{File::SEPARATOR}(.*)/).first next false unless scanned load_name = scanned[1] break ix end return false unless load_path_index more_load_paths = $LOAD_PATH.drop(load_path_index + 1) more_load_paths.each do |load_path| path = File.join(load_path, load_name) if File.exist?(path) return require_dependency path end end raise LoadError, "cannot require more -- #{load_name}" end |