David Heinemeier Hansson wrote:

> Somethings rotten...
> 
> david% irb
> irb(main):001:0> require 'Singleton'
> irb(main):002:0> class Something
> irb(main):003:1> include Singleton
> irb(main):004:1> end
> irb(main):005:0> require 'log4r'
> /usr/local/lib/ruby/1.8/singleton.rb:119: warning: already initialized  
> constant FirstInstanceCall
> NameError: undefined method `extend_object' for `Singleton'

On windows you will get the same error message. However, if you
write

---
require 'singleton'
class A
   include Singleton
end
require 'log4r'
---

you'll be fine.  My guess is that ruby ``thinks'' that  ``Singleton.rb"
and ``singleton.rb" (in my case installed in E:/Ruby/lib/ruby/1.8)
are different files - however in the windows world or on a Macs
HFS+ file-system  ``Singleton.rb" and ``singleton.rb'' refer to the
same file.

This difference  results in unnecessary reload of ``singleton.rb''
which in turn triggers the NameError of Ruby trying to undefine
an already undefined method  (extend_object).

I suggest that you consistently use the lower case version require
'singleton'.  Alternatively change the line

161 >  undef_method :extend_object

in singleton.rb to

161 >  undef_method :extend_object  unless defined? :extend_object


/Christoph