From: E S Date: 2005-02-12T16:03:11+09:00 Subject: Re: Creating objects from a template > L�hett�j�: nobu.nokada@softhome.net > Aihe: Re: Creating objects from a template > > Hi, > > At Sat, 12 Feb 2005 13:16:23 +0900, > E S wrote in [ruby-talk:130578]: > > > my_new_unit = types["Panzer"].new.extend(Unit) # As later > > > > I thought #extend only works for instance methods, not variables? > > extend_object module method will be called. > > module Unit > def self.extend_object(obj) > super > obj._unit_initialize > end > end Yep, sure enough it seems to work (which is obviously a very good thing)! I'm relying on ruby-doc.org from work and looks like the source doc they're using is outdated/incorrect/inaccurate: obj.extend: Adds to obj the instance methods from each module given as a parameter. mod.extend_object: Extends the specified object by adding this module�s constants and methods (which are added as singleton methods). > -- > Nobu Nakada Thanks! E