Stefan Mahlitz
5/17/2008 8:24:00 AM
Peter Bunyan wrote:
> 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>
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>