load & require
2015-05-29 16:44
330 查看
The 'require' method will not look in the current directory for files to load(but you can use require './test.rb' to look in the current directory), but 'load' will.
If called more than once, 'require' will not reload the file while 'load' will. Suppose you're writing some code in a file and require it into irb. But it's failed, you fixed the failure and require it again, you won't get the fixed version. You need to use load to get the fixed version. So use 'require' in script file and 'load' in irb.
The 'require' method figures out the extension('.rb', '.so', '.dll'..) for you, but 'load' won't. So you need to use them like this:
If called more than once, 'require' will not reload the file while 'load' will. Suppose you're writing some code in a file and require it into irb. But it's failed, you fixed the failure and require it again, you won't get the fixed version. You need to use load to get the fixed version. So use 'require' in script file and 'load' in irb.
The 'require' method figures out the extension('.rb', '.so', '.dll'..) for you, but 'load' won't. So you need to use them like this:
require 'test' load 'test.rb'
相关文章推荐
- equinox提供了啥服务
- (转)RMAN-06054: media recovery requesting unknown archived log for thread...
- UI常用方法总结之 UINavigationController
- XHNewsFrameworkExample
- Android QuickContactBadge
- Android QuickContactBadge
- 10.2 NSOperation/NSOperationQueue:提供了一些在GCD中不容易实现的特性,如:限制最大并发数量,操作之间的依赖关系.
- 使用xcodebuild命令行编译iOS应用遇到的一个错误及解决办法
- easyui datagrid中动态改变某行的颜色
- ios8 UITableView设置 setSeparatorInset:UIEdgeInsetsZero不起作用的解决办法
- UIScrollView滚动到制定的位置
- easyUI中datagrid如何展示对象下属性的多个子属性
- iOS之默认搜索UISearchDisplayController
- iOS真机UI调试利器——Reveal(在原转载上有所修改)
- VDI ipad通过AD+Raduis认证配置
- 解决Mygui不支持中文路径
- android出现the project was not built due to "a resource exists with a different case问题
- @RequestParam的作用
- 漂亮UI的全能音乐播放器
- Android UI开发第十四篇——可以移动的悬浮框