Robert Klemme wrote:
> Turning back to your original example: it looks like what you really
> want is to do "require 'ui'"

I don't think it's safe to do "require 'ui'". Some other library may a 
have a file by the same name and Ruby may load it instead of ours.

So one should do "require 'mylibrary/ui'" instead.

(Or one could feed require() an absolute path, but I don't see people 
doing this.)

Alpha Blue wrote:
> Also, if you accidentally nest a require, say for example:
>
> --root\
> -- app.rb
> ----\lib
> ---- main.rb
> ---- modules.rb
>
> .. note that modules.rb and main.rb are within the same directory 
> (main).
>
> If your app.rb has require 'lib/main'
> .. and
> If your main.rb has require 'modules'

Same problem. If some other library has 'modules.rb', Ruby may load if 
instead of ours.

The directory structure should be:

> --root\
> -- app.rb
> ----\lib
> -------myapp.rb   (instead of 'main.rb')
> -------\myapp
> ------- modules.rb

app.rb should push Dir.basename(__FILE__) + '/lib' onto $: (if it's not 
already there). Then, it should require 'myapp.rb'. myapp.rb should 
'require "myapp/modules.rb"'. Then there's no risk that Ruby will load 
other library's files because, by having a 'myapp' subdir were 
effectively creating a namespace.
-- 
Posted via http://www.ruby-forum.com/.