From: "Iñaki Baz Castillo" Date: 2009-02-05T00:05:53+09:00 Subject: Re: Using a Class (not an instance) into threads 2009/2/4 Ilan Berci : > This is not an example of a "singleton class". It is merely a class > with static methods which means that you don't have to make an instance > prior to using it. Thanks for pointing it out. When defining an attribute into "class << self [..] end" it means that it is an instance attribute of the class (since in Ruby a Class is also an instance). I though that *this* was called "Singleton". > If the class that Ragel populated has no state > (which I don't believe it does) then it can safely be used in a threaded > context. During a method into MyParser class, there are *a lot* of attributes whose value change, and that value is important to remain when the function ends, so I understand that the class that Ragel populated does have state, am I wrong? > If you need further examples, please check out all the class level > methods in Math ok, I'll do. > ================================================================= > As for "singleton class", The class is not the object itself as you > stated, but a class created solely for that instance. > > class Foo > end > > f = Foo.new > def f.poo > 1 > end > > f.class <== Foo > f.poo <=== 1 > Foo.new.poo <== undefined method! I was wrong, thanks for clarifing :) -- Iñaki Baz Castillo