From: Norman Makoto Su Date: 2002-04-23T10:09:52+09:00 Subject: building extensions-- new vs initialize Hi, I'm trying to build a ruby extension in C. While looking at the pickaxe CD player example, I noticed that they define a singleton_method called "new" and then a normal method called "initialize". What is the motivation for this? Is it so that when you call CDPlayer.new, the returned object is of type Data? (this can't be achieved with just initialize?) I'm confused as to when it is or not neccessary to define a "new" method in addition to an "initialize" method. For example, when defining class variables, does this have to be done in a "new" method, since the class has not been instantiated? One last thing, would someone mind giving me the an example of the correct way to make a class that includes the Singleton method and then define the "instance" method (using rb_require, rb_include_module, etc...) Thank you, please excuse my inexperience, -- Norman