Hi --

On Thu, 13 Jul 2006, David Chelimsky wrote:

> Well, I discovered the solution, thanks to our friend google, and got a much 
> better understanding of singleton classes (though the fog hasn't completely 
> dissipated). For anyone interested:
>
> thing_singleton_class = class << Thing; self; end
> thing_singleton_class.send(:define_method, :class_method, proc { "replaced" 
> })
>
> Thing.class_method
> => "replaced"

Don't forget that you can do this much more concisely (unless you have
a specific need to go the long way round):

   def Thing.class_method
     "replaced"
   end


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
http://www.manning.com/black     => RUBY FOR RAILS, the Ruby book for
                                                     Rails developers
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
dblack / wobblini.net              => me