So I'm still a bit confused at how load paths work basically I have a file structure like:
my_app
bin
my_bin
lib
processor.rb
So the problem is the the file my_bin
is a bin file (in ruby) that is supposed to call a class and method in processor.rb
The bin file requires gems and other stuff at the top, but how can I have the classes in processor.rb
loaded?
in 1.9.2 you can do:
require_relative '../lib/processor'
in 1.8.7 you can do:
$: << "/absolute/path/to_parent_of_lib/lib"
require 'processor'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.