`
liano
  • 浏览: 25372 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

LOAD_PATH and CLASS_PATH

阅读更多
$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.

分享到:
评论

相关推荐

    人脸识别程序,运用python软件

    if not os.path.isdir(os.path.join(train_dir, class_dir)): continue # 结束当前循环, 进入下一个循环 # 遍历这个人的每一张照片 for img_path in ifi(os.path.join(train_dir, class_dir)): image = fr.load...

    bootscale:通过缓存要求调用来加速应用程序启动

    为$LOAD_PATH正确性,每次调用Bootscale.regenerate修改$LOAD_PATH都应更新缓存。 对于Rails应用程序,这意味着在config/application.rb添加一个初始化config/application.rb 。 module MyApp class Application ...

    ( ap6181_sina33m_sc3817r验证通过_20170710_1608没有外层目录.7z

    WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path" BOARD_USR_WIFI := ap6181 include hardware/broadcom/wlan/bcmdhd/firmware/$(BOARD_USR_WIFI)/device-bcm.mk endif # 2. ...

    Java学习测试题,看你会多少(主要基础类)

    publicclass Singleton { privatestatic Singleton instance; privatestaticfinal String CONFIG_FILE_PATH = "E:\\config.properties"; private Properties config; private Singleton() { config = ...

    php zend 相对路径问题

    php define (‘P_S’, PATH_SEPARATOR); define (‘ROOT’, “../”); set_include_path(ROOT .P_S .’Zend’ .P_S .ROOT.get_include_path()); require_once ROOT.’Zend/Loader.php’; Zend_Loader::loadClass(...

    Laravel实现autoload方法详解

    用了一阵Laravel后发现很少有include和require,觉得有点奇怪,思考Laravel是怎么完成文件导入的。 其实Laravel依旧还是用include...$classmap=[ 'DB'=&gt;'api.php', 'FileSystem'=&gt;'api.php', 'Session'=&gt;'api.php

    PHP 数据库树的遍历方法

    define (‘P_S’, PATH_SEPARATOR); define (‘ROOT’, “./”); set_include_path(ROOT .P_S .’Zend’ .P_S .ROOT.get_include_path()); //加载ZEND 框架 require_once ROOT.’Zend/Loader.php’; require_once ...

    python3:excel操作之读取数据并返回字典 + 写入的案例

    excel写入数据,使用openpyxl库 class WriteExcel: def __init__(self,path): ... wb = openpyxl.load_workbook(self.path) ws = wb[sheet_name] # 获取最大行 row_num = ws.max_row try: ws.cell(ro

    class E PA for pulsed transmitters

    The extended design space provides important possibilities for wide band design of the class-E load networks and for further efficiency optimization of class-E PAs. A wide band design methodology is ...

    mot17_half.pth

    python demo.py tracking --load_model ../models/mot17_half.pth --num_class 1 --demo /path/to/image/or/folder/or/video

    带注释的Bootstrap.java

    private static final Pattern PATH_PATTERN = Pattern.compile("(\".*?\")|(([^,])*)"); static { // Will always be non-null //System.getProperty("user.dir"),获取当前目录 //由于是在$CATALINA_HOME\...

    php中使用__autoload()自动加载未定义类的实现代码

    php/*** 自动加载相关类库文件*/function __autoload($classname){if(substr($classname,-6)==”Action”){include APP_PATH.’controllers/’.$classname.’.class.php’;}elseif(substr($classname, -5)==”Model...

    dinov2代码与预训练模型

    dinov2代码与预训练模型

    hskl:使用scikit-learn进行高光谱图像分析的库

    HSKL:高光谱-scikit学习 ...# Download, unpack, and load HyRANK dataset from current directory. path = os . getcwd () if not os . path . exists ( "HyRANK_satellite" ): dl_hyrank ( path ) ima

    python.demo.py

    File "&lt;frozen importlib._bootstrap&gt;", line 955, in _find_and_load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 665, in _load_unlocked File "&lt;frozen importlib._bootstrap_external&gt;", line ...

    MATLAB External Interfaces

    • “Load Class Using Java Class.forName Method” on page 1-18 • “Dynamic Path” on page 1-19 • “Call Method in Your Own Java Class” on page 1-20 • “How MATLAB Represents Java Arrays” on page ...

    GAMS Python API documentation 24.0

    All these files can be specified with a (relative) path and therefore an anchor into the file system is required. The base class GamsWorkspace manages the anchor to the file system. If external file ...

    CI框架装载器Loader.php源码分析

    顾名思义,装载器就是加载元素的,使用C...$this-&gt;load-&gt;add_package_path() 复制代码 代码如下: /**  * Loader Class  *  * 用户加载views和files,常见的函数有model(),view(),library(),helper()  *  * Contro

    javax.persistence.jar

    javax.persistence.criteria.Path.class javax.persistence.criteria.PluralJoin.class javax.persistence.criteria.Predicate.class javax.persistence.criteria.Root.class javax.persistence.criteria.Selection....

    php.ini-development

    PHP attempts to find and load this configuration from a number of locations. ; The following is a summary of its search order: ; 1. SAPI module specific location. ; 2. The PHPRC environment variable....

Global site tag (gtag.js) - Google Analytics