论坛首页 编程语言技术论坛

LOAD_PATH and CLASS_PATH

浏览 2212 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (8)
作者 正文
   发表时间:2008-09-12  
$LOAD_PATH in ruby.

$LOAD_PATH in ruby is similar to class_path in java.

class_path contains many jar position.
every jar has its own structure leading to a java File.

$LOAD_PATH contains many ruby lib position.
usually, in lib directory, a directory containing different ruby Files can be found.
for example:
../lib/spec/
../lib/spec.rb

$LOAD_PATH can be set up like : $LOAD_PATH << ..../lib
and then we can require what we need like : require "spec",
this way, the spec.rb file is required.
we don't need to specify the entire path in require command.

how does it work in rails?

in rails, the gem libary is included in enviroment.rb usually.
rspec plugin is include in spec.rake, because rspec is runned always by rake.

论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics