Hi

Brian Schroeder wrote:

> I need the constants defined in the module to be included in my class, it
> seems that extend only includes the instance methods.

That's the default behaviour of extend. If you wanted to do extra things 
when a module extends an object, you can define a custom "extended" 
module method. This is a hook that is run every time an object's 
extended with that module.

For example, to do what you want to do:

----------------------
class Foo
end

module Qux
   MY_CONSTANT = 'HEADACHE'
   def Qux.extended(obj)
     constants.each do | const |
       obj.class.class_eval { const_set(const, Qux.const_get(const))}
     end
   end
end

f = Foo.new()
f.extend(Qux)

p Foo::MY_CONSTANT  # --> 'HEADACHE'
----------------------

Note that this means that actions upon an instance will affect the 
global definition of that instance's class, which may or may not be what 
you want.

You might also be interested in the 'included' and 'append_features' 
methods of Module. IIRC, 'extended' and 'included' were added in Ruby 1.8.0.

cheers
alex