i know this is dirt simple, but i am totally not getting it.. i have a file called "syndication.rb" that includes some modules that i need... in the same directory, i have a file that says: require 'syndication/rhapsody' when i try to run the program, i get: LoadError: no such file to load — syndication/rhapsody anyone have any ideas? thanks!
on 14.05.2008 16:44
on 14.05.2008 17:36
Sergio Ruiz wrote: > i have a file called "syndication.rb" > in the same directory, i have a file that says: > require 'syndication/rhapsody' Of course this is wrong. This 'require' loads a file 'syndication/rhapsody.rb'. But you want to load the file 'syndication.rb'. So change it to: require 'syndication' BTW, if you're launching your program not from the directory where it resides, then loading the module would fail. You'll have to tell ruby to load files also from the directory in which you program resides: $:.unshift File.dirname(__FILE__) require 'syndication'
on 15.05.2008 20:27
just for the record, i found that the above was indeed the case! thanks so much!
on 16.05.2008 10:16
Albert Schlef wrote: > BTW, if you're launching your program not from the directory where it > resides, then loading the module would fail. You'll have to tell ruby to > load files also from the directory in which you program resides: > > $:.unshift File.dirname(__FILE__) > require 'syndication' irb(main):001:0> $:[-1] => "." irb(main):002:0>
on 17.05.2008 10:24
Peter Bunyan wrote:
> irb(main):002:0>
zaphy@servierer:~/temp/ruby-lang$ ls lib/
albert_lib.rb cool_lib.rb other_lib.rb
zaphy@servierer:~/temp/ruby-lang$ irb
irb(main):001:0> require "lib/cool_lib"
LoadError: no such file to load -- other_lib
from ./lib/cool_lib.rb:1:in `require'
from ./lib/cool_lib.rb:1
from (irb):1
irb(main):002:0> require "lib/albert_lib"
=> true
irb(main):003:0>