From: "Iñaki Baz Castillo" Date: 2009-02-06T22:27:01+09:00 Subject: Re: Using a Class (not an instance) into threads 2009/2/6 Julian Leviston : > What do you mean by faster? For who? ------------------------ class MyClass class << self puts "Starting MyClass..." @my_var = 1 end class << self def hello puts "hello I'm MyClass" end end end class MyClass2 def initialize puts "Initializing instance of MyClass2..." @my_var = 1 end def hello puts "hello I'm instance of MyClass2" end end MyClass.hello MyClass.hello MyClass2.new.hello MyClass2.new.hello ------------------------ output: -------------------- Starting MyClass... hello I'm MyClass hello I'm MyClass Initializing instance of MyClass2... hello I'm instance of MyClass2 Initializing instance of MyClass2... hello I'm instance of MyClass2 -------------------- As you see, the MyClass code: puts "Starting MyClass..." @my_var = 1 is executed *just* at the start of the program, while the code: puts "Initializing instance of MyClass2..." @my_var = 1 is executed for each MyClass2 initialization (logic of course). Regards. -- Iñaki Baz Castillo