Sam Stephenson wrote:
> I'm trying to nest modules to create namespaces, but I'm not having
> much luck. Let's say I have

You need to make foo a module method of B:

> | module A
> |   module B
> |     def foo; @foo end
         def B::foo; @foo; end
> |   end
> | end
> |
> | class Foo
> |   include A
> |   def initialize; @foo = 'foo' end
> |   def bar; B::foo end
> | end
> 
> Calling Foo#bar raises "NoMethodError: undefined method `foo' for
> A::B.Module".  I would like to get "foo".  What am I doing wrong?
> 
> Sam

The way you had it originally, you were defining an _instance_ method of 
B. If you had included B in some class, you could then call foo as an 
method of instances of that class.